Commit 9f906fb2 authored by Denys M's avatar Denys M Committed by Sebastian Kaspari
Browse files

For #2346. Enable kotlin warningsAsErrors for `feature-prompts` module.

parent 152dd3fb
......@@ -12,7 +12,6 @@ object KotlinCompiler {
// Maybe this is easier in Gradle 5+.
@JvmStatic
val projectsWithWarningsAsErrorsDisabled = setOf(
"browser-domains",
"feature-prompts"
"browser-domains"
)
}
......@@ -153,6 +153,7 @@ class PromptFeature(
* @param grantResults The grant results for the corresponding permissions
* @see [onNeedToRequestPermissions].
*/
@Suppress("UNUSED_PARAMETER")
fun onPermissionsResult(permissions: Array<String>, grantResults: IntArray) {
if (grantResults.isNotEmpty() && grantResults.all { it == PackageManager.PERMISSION_GRANTED }) {
onPermissionsGranted()
......
......@@ -27,7 +27,7 @@ private const val KEY_SELECTED_DATE = "KEY_SELECTED_DATE"
private const val KEY_SELECTION_TYPE = "KEY_SELECTION_TYPE"
/**
* [android.support.v4.app.DialogFragment] implementation to display date picker with a native dialog.
* [DialogFragment][androidx.fragment.app.DialogFragment] implementation to display date picker with a native dialog.
*/
@Suppress("TooManyFunctions")
internal class TimePickerDialogFragment : PromptDialogFragment(), DatePicker.OnDateChangedListener,
......@@ -110,7 +110,7 @@ internal class TimePickerDialogFragment : PromptDialogFragment(), DatePicker.OnD
return view
}
@SuppressWarnings("deprecation")
@Suppress("DEPRECATION")
private fun bind(picker: TimePicker, cal: Calendar) {
if (Build.VERSION.SDK_INT >= M) {
picker.hour = cal.get(Calendar.HOUR_OF_DAY)
......
......@@ -54,7 +54,7 @@ class TimePickerDialogFragmentTest {
dialog.show()
val titleTextView = dialog.findViewById<TextView>(androidx.appcompat.R.id.alertTitle)
val datePicker = dialog.findViewById<DatePicker>(mozilla.components.feature.prompts.R.id.date_picker)
val datePicker = dialog.findViewById<DatePicker>(R.id.date_picker)
assertEquals(titleTextView.text, "title")
assertEquals(2019, datePicker.year)
......@@ -147,7 +147,7 @@ class TimePickerDialogFragmentTest {
val dialog = fragment.onCreateDialog(null)
dialog.show()
val datePicker = dialog.findViewById<DatePicker>(mozilla.components.feature.prompts.R.id.date_picker)
val datePicker = dialog.findViewById<DatePicker>(R.id.date_picker)
assertEquals(2018, datePicker.year)
assertEquals(6, datePicker.month + 1)
......@@ -156,14 +156,15 @@ class TimePickerDialogFragmentTest {
assertEquals(minDate, Date(datePicker.minDate))
assertEquals(maxDate, Date(datePicker.maxDate))
val timePicker = dialog.findViewById<TimePicker>(mozilla.components.feature.prompts.R.id.datetime_picker)
val timePicker = dialog.findViewById<TimePicker>(R.id.datetime_picker)
assertEquals(19, timePicker.hour)
assertEquals(30, timePicker.minute)
}
@Config(sdk = [LOLLIPOP])
@Test
@Config(sdk = [LOLLIPOP])
@Suppress("DEPRECATION")
fun `building a time picker`() {
val initialDate = "2018-06-12T19:30".toDate("yyyy-MM-dd'T'HH:mm")
val minDate = "2018-06-07T00:00".toDate("yyyy-MM-dd'T'HH:mm")
......@@ -184,7 +185,7 @@ class TimePickerDialogFragmentTest {
val dialog = fragment.onCreateDialog(null)
dialog.show()
val timePicker = dialog.findViewById<TimePicker>(mozilla.components.feature.prompts.R.id.time_picker)
val timePicker = dialog.findViewById<TimePicker>(R.id.time_picker)
assertEquals(19, timePicker.currentHour)
assertEquals(30, timePicker.currentMinute)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment