Skip to content

Commit 74abdf3

Browse files
authored
Add hint support to input dialog (#7)
1 parent 1f5340f commit 74abdf3

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ publish {
3737
userOrg = 'buffer'
3838
groupId = 'org.buffer.android'
3939
artifactId = 'android-components'
40-
publishVersion = '1.3'
40+
publishVersion = '1.4'
4141
desc = 'An Android library for frequently used UI components'
4242
website = 'https://github.com/bufferapp/android-components'
4343
}

app/src/main/java/org/buffer/android/components/DialogFactory.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,11 @@ object DialogFactory {
306306
@StringRes positive: Int,
307307
@StringRes negative: Int,
308308
inputListener: InputListener,
309-
defaultText: String
309+
defaultText: String ?= null,
310+
hintText: String ?= null
310311
): AlertDialog {
311-
return getSimpleInputDialogBuilder(context, titleResource, positive,
312-
negative, inputListener, defaultText, InputType.TYPE_TEXT_VARIATION_URI).create()
312+
return getSimpleInputDialogBuilder(context, titleResource, positive, negative,
313+
inputListener, defaultText, hintText, InputType.TYPE_TEXT_VARIATION_URI).create()
313314
}
314315

315316
private fun getSimpleInputDialogBuilder(
@@ -319,6 +320,7 @@ object DialogFactory {
319320
@StringRes negative: Int,
320321
inputListener: InputListener,
321322
defaultText: String?,
323+
hintText: String?,
322324
inputType: Int
323325
): AlertDialog.Builder {
324326
val builder = MaterialAlertDialogBuilder(context)
@@ -331,6 +333,7 @@ object DialogFactory {
331333
input.maxLines = 8
332334
}
333335
if (defaultText != null) input.setText(defaultText)
336+
if (hintText != null) input.hint = hintText
334337

335338
val padding = DisplayMetricsUtil.dpToPx(16)
336339
builder.setView(input, padding, 0, padding, 0)

0 commit comments

Comments
 (0)