@@ -35,9 +35,13 @@ import android.widget.Button
35
35
import android.widget.ScrollView
36
36
import androidx.annotation.NonNull
37
37
import androidx.core.content.ContextCompat
38
+ import androidx.core.widget.TextViewCompat
38
39
import androidx.recyclerview.widget.LinearLayoutManager
39
40
import androidx.recyclerview.widget.RecyclerView
41
+ import com.example.android.mediacontroller.databinding.ActivityMediaAppTestingBinding
40
42
import com.example.android.mediacontroller.databinding.MediaTestSuiteResultBinding
43
+ import com.example.android.mediacontroller.databinding.RunSuiteIterDialogBinding
44
+ import com.example.android.mediacontroller.databinding.TestSuiteResultsDialogBinding
41
45
42
46
import java.util.concurrent.Semaphore
43
47
import kotlin.concurrent.thread
@@ -149,7 +153,8 @@ class MediaAppTestSuite(val testSuiteName: String, val testSuiteDescription: Str
149
153
dialog.apply {
150
154
setCancelable(false )
151
155
requestWindowFeature(Window .FEATURE_NO_TITLE )
152
- setContentView(R .layout.run_suite_iter_dialog)
156
+ var binding = RunSuiteIterDialogBinding .inflate(layoutInflater)
157
+ setContentView(binding.root)
153
158
progressBar = findViewById<ProgressBar >(R .id.suite_iter_progress_bar).apply {
154
159
max = numIter * testList.size
155
160
progress = - 1
@@ -275,7 +280,7 @@ class MediaAppTestSuite(val testSuiteName: String, val testSuiteDescription: Str
275
280
for (test in testList) {
276
281
iDToResultsMap[test.id] = TestCaseResults ()
277
282
}
278
- resultsAdapter = ResultsAdapter (arrayOf< TestOptionDetails > ())
283
+ resultsAdapter = ResultsAdapter (arrayOf())
279
284
testSuiteResultsLayout.removeAllViews()
280
285
displayResults()
281
286
}
@@ -293,7 +298,7 @@ class MediaAppTestSuite(val testSuiteName: String, val testSuiteDescription: Str
293
298
/* *
294
299
* Class to store all of a tests resulting info.
295
300
*/
296
- inner class TestCaseResults () {
301
+ inner class TestCaseResults {
297
302
var totalRuns = 0
298
303
var numPassing = 0
299
304
var passingLogs = arrayListOf<ArrayList <String >>()
@@ -347,7 +352,9 @@ class MediaAppTestSuite(val testSuiteName: String, val testSuiteDescription: Str
347
352
override fun onClick (p0 : View ? ) {
348
353
var dialog = Dialog (context).apply {
349
354
requestWindowFeature(Window .FEATURE_NO_TITLE )
350
- setContentView(R .layout.test_suite_results_dialog)
355
+
356
+ val binding = TestSuiteResultsDialogBinding .inflate(layoutInflater)
357
+ setContentView(binding.root)
351
358
findViewById<TextView >(R .id.results_title).text = name
352
359
findViewById<TextView >(R .id.results_subtitle).text = description
353
360
@@ -358,15 +365,15 @@ class MediaAppTestSuite(val testSuiteName: String, val testSuiteDescription: Str
358
365
for (logsList in iDToResultsMap[testId]!! .passingLogs) {
359
366
passing_results_log.addView(TextView (context).apply {
360
367
text = resources.getString(R .string.test_iter_divider)
361
- setTextAppearance(context , R .style.SubHeader )
368
+ TextViewCompat . setTextAppearance(this , R .style.SubHeader )
362
369
gravity = Gravity .CENTER
363
370
setTextColor(PASSING_COLOR )
364
371
})
365
372
for (line in logsList) {
366
- var logLine = TextView (context).apply {
373
+ val logLine = TextView (context).apply {
367
374
text = line
368
375
369
- setTextAppearance(context , R .style.SubText )
376
+ TextViewCompat . setTextAppearance(this , R .style.SubText )
370
377
}
371
378
passing_results_log.addView(logLine)
372
379
}
@@ -382,14 +389,14 @@ class MediaAppTestSuite(val testSuiteName: String, val testSuiteDescription: Str
382
389
for (logsList in iDToResultsMap[testId]!! .failingLogs) {
383
390
failing_results_log.addView(TextView (context).apply {
384
391
text = resources.getString(R .string.test_iter_divider)
385
- setTextAppearance(context , R .style.SubHeader )
392
+ TextViewCompat . setTextAppearance(this , R .style.SubHeader )
386
393
gravity = Gravity .CENTER
387
394
setTextColor(FAILING_COLOR )
388
395
})
389
396
for (line in logsList) {
390
- var logLine = TextView (context).apply {
397
+ val logLine = TextView (context).apply {
391
398
text = line
392
- setTextAppearance(context , R .style.SubText )
399
+ TextViewCompat . setTextAppearance(this , R .style.SubText )
393
400
}
394
401
failing_results_log.addView(logLine)
395
402
}
@@ -399,7 +406,7 @@ class MediaAppTestSuite(val testSuiteName: String, val testSuiteDescription: Str
399
406
findViewById<TextView >(R .id.failing_logs_header).visibility = View .GONE
400
407
}
401
408
findViewById<ScrollView >(R .id.results_scroll_view).layoutParams.height = (MediaAppTestingActivity .getScreenHeightPx(context) / 2 ).toInt()
402
- findViewById<Button >(R .id.close_results_button).setOnClickListener( View . OnClickListener { dismiss() })
409
+ findViewById<Button >(R .id.close_results_button).setOnClickListener { dismiss() }
403
410
}.show()
404
411
}
405
412
}
0 commit comments