Skip to content

Commit 3dc4f8c

Browse files
author
therealbluepandabear
committed
Fix #196.
1 parent 9f48c45 commit 3dc4f8c

6 files changed

Lines changed: 14 additions & 18 deletions

File tree

app/src/main/java/com/therealbluepandabear/pixapencil/activities/canvas/oncreate/menu/CanvasActivity+onMenuItemSelected.kt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import android.graphics.Color
55
import android.view.MenuItem
66
import android.view.ViewGroup
77
import android.widget.RadioGroup
8-
import android.widget.TextView
98
import androidx.constraintlayout.widget.ConstraintLayout
109
import androidx.core.widget.doAfterTextChanged
1110
import com.android.volley.Request
@@ -78,22 +77,16 @@ fun CanvasActivity.onMenuItemSelected(item: MenuItem): Boolean {
7877
val fileNameTextInputLayout =
7978
exportRootLayout.findViewById<TextInputLayout>(R.id.exportProjectDialogLayout_fileNameTextInputLayout)
8079

81-
val fileTypeTextView = exportRootLayout.findViewById<TextView>(R.id.textView2)
82-
val defaultFileTypeTextViewTopMargin = (fileTypeTextView.layoutParams as ViewGroup.MarginLayoutParams).topMargin
83-
8480
exportRootLayout.post {
8581
// We do this so that there is no default top margin, which I personally find it ugly
8682
(exportRootLayout.layoutParams as ViewGroup.MarginLayoutParams).topMargin = 0
8783

8884
fileNameTextInputEditText.setText(projectTitle)
8985
fileNameTextInputEditText.doAfterTextChanged {
9086
if (it.toString().isNotBlank()) {
91-
fileNameTextInputLayout.error = ""
92-
(fileNameTextInputLayout.layoutParams as ViewGroup.MarginLayoutParams).bottomMargin = 0
93-
(fileTypeTextView.layoutParams as ViewGroup.MarginLayoutParams).topMargin = 0
87+
fileNameTextInputLayout.isErrorEnabled = false
9488
} else {
9589
fileNameTextInputLayout.error = getString(R.string.exception_invalid_file_name)
96-
(fileTypeTextView.layoutParams as ViewGroup.MarginLayoutParams).topMargin = defaultFileTypeTextViewTopMargin
9790
}
9891
}
9992
}
@@ -164,7 +157,6 @@ fun CanvasActivity.onMenuItemSelected(item: MenuItem): Boolean {
164157
alertDialog.cancel()
165158
} else {
166159
fileNameTextInputLayout.error = getString(R.string.exception_invalid_file_name)
167-
(fileTypeTextView.layoutParams as ViewGroup.MarginLayoutParams).topMargin = defaultFileTypeTextViewTopMargin
168160
}
169161
}
170162
}

app/src/main/java/com/therealbluepandabear/pixapencil/fragments/newcolorpalette/NewColorPaletteFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class NewColorPaletteFragment : Fragment(), ActivityFragment {
5050

5151
binding.fragmentNewColorPaletteColorPaletteNameTextInputEditText.doAfterTextChanged {
5252
if (binding.fragmentNewColorPaletteColorPaletteNameTextInputEditText.text.toString().isNotBlank()) {
53-
binding.fragmentNewColorPaletteColorPaletteNameTextInputLayout.error = null
53+
binding.fragmentNewColorPaletteColorPaletteNameTextInputLayout.isErrorEnabled = false
5454
}
5555
}
5656

app/src/main/java/com/therealbluepandabear/pixapencil/fragments/newproject/NewProjectFragment+setOnClickListeners.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private fun NewProjectFragment.checkForTitleError() {
2121
binding.fragmentNewCanvasProjectTitleTextInputLayout.error = getString(R.string.exception_invalid_project_name)
2222
invalidTitle = true
2323
} else {
24-
binding.fragmentNewCanvasProjectTitleTextInputLayout.error = null
24+
binding.fragmentNewCanvasProjectTitleTextInputLayout.isErrorEnabled = false
2525
invalidTitle = false
2626
}
2727
}
@@ -39,7 +39,7 @@ private fun NewProjectFragment.checkForWidthError() {
3939
}
4040

4141
else -> {
42-
binding.fragmentNewCanvasWidthTextInputLayout.error = null
42+
binding.fragmentNewCanvasWidthTextInputLayout.isErrorEnabled = false
4343
invalidWidth = false
4444
}
4545
}
@@ -58,7 +58,7 @@ private fun NewProjectFragment.checkForHeightError() {
5858
}
5959

6060
else -> {
61-
binding.fragmentNewCanvasHeightTextInputLayout.error = null
61+
binding.fragmentNewCanvasHeightTextInputLayout.isErrorEnabled = false
6262
invalidHeight = false
6363
}
6464
}

app/src/main/java/com/therealbluepandabear/pixapencil/fragments/spraytoolsettings/SprayToolSettingsFragment+setOnClickListeners.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private fun SprayToolSettingsFragment.checkForRadiusError() {
2121
}
2222

2323
else -> {
24-
binding.fragmentSprayToolSettingsRadiusTextInputLayout.error = null
24+
binding.fragmentSprayToolSettingsRadiusTextInputLayout.isErrorEnabled = false
2525
invalidRadius = false
2626
}
2727
}
@@ -40,7 +40,7 @@ private fun SprayToolSettingsFragment.checkForStrengthError() {
4040
}
4141

4242
else -> {
43-
binding.fragmentSprayToolSettingsStrengthTextInputLayout.error = null
43+
binding.fragmentSprayToolSettingsStrengthTextInputLayout.isErrorEnabled = false
4444
invalidStrength = false
4545
}
4646
}

app/src/main/res/layout/export_project_dialog_layout.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
android:layout_marginStart="16dp"
1212
android:layout_marginTop="16dp"
1313
android:layout_marginEnd="16dp"
14-
android:hint="File Name"
14+
android:hint="@string/exportProjectDialogLayout_file_name_str"
1515
app:layout_constraintEnd_toEndOf="parent"
1616
app:layout_constraintStart_toStartOf="parent"
1717
app:layout_constraintTop_toTopOf="parent">
@@ -27,7 +27,7 @@
2727
android:layout_width="wrap_content"
2828
android:layout_height="wrap_content"
2929
android:layout_marginTop="24dp"
30-
android:text="File Type"
30+
android:text="@string/exportProjectDialogLayout_file_type_str"
3131
app:layout_constraintStart_toStartOf="@+id/exportProjectDialogLayout_fileNameTextInputLayout"
3232
app:layout_constraintTop_toBottomOf="@+id/exportProjectDialogLayout_fileNameTextInputLayout" />
3333

@@ -114,7 +114,7 @@
114114
android:layout_width="wrap_content"
115115
android:layout_height="wrap_content"
116116
android:layout_marginTop="24dp"
117-
android:text="Resolution"
117+
android:text="@string/exportProjectDialogLayout_resolution_str"
118118
app:layout_constraintStart_toStartOf="@+id/exportProjectDialogLayout_fileNameTextInputLayout"
119119
app:layout_constraintTop_toBottomOf="@+id/horizontalScrollView" />
120120

app/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
<string name="projectDetailsAlertBox_created">Created</string>
4040
<string name="projectDetailsAlertBox_colors">Colors</string>
4141

42+
<string name="exportProjectDialogLayout_file_name_str">File Name</string>
43+
<string name="exportProjectDialogLayout_file_type_str">File Type</string>
44+
<string name="exportProjectDialogLayout_resolution_str">File Type</string>
45+
4246
<!--Other strings-->
4347
<string name="recentCreationsLayout_subtitle" translatable="false">%1$dx%2$d</string>
4448

0 commit comments

Comments
 (0)