1
- package by.twitter.ui.search
1
+ package by.twitter.ui.error
2
2
3
3
import android.os.Bundle
4
4
import android.view.LayoutInflater
5
5
import android.view.View
6
6
import androidx.fragment.app.Fragment
7
7
import by.twitter.R
8
8
import com.google.android.material.dialog.MaterialAlertDialogBuilder
9
- import kotlinx.android.synthetic.main.dialog_search.view.*
10
- import kotlinx.android.synthetic.main.fragment_search.*
9
+ import kotlinx.android.synthetic.main.dialog_error.view.*
10
+ import kotlinx.android.synthetic.main.fragment_error.*
11
+ import java.lang.RuntimeException
11
12
12
- class SearchFragment : Fragment (R .layout.fragment_search ) {
13
+ class ErrorFragment : Fragment (R .layout.fragment_error ) {
13
14
14
15
override fun onViewCreated (view : View , savedInstanceState : Bundle ? ) {
15
16
super .onViewCreated(view, savedInstanceState)
@@ -20,12 +21,13 @@ class SearchFragment : Fragment(R.layout.fragment_search) {
20
21
}
21
22
22
23
private fun displayDialog () {
23
- val dialogView = LayoutInflater .from(requireContext()).inflate(R .layout.dialog_search , null )
24
+ val dialogView = LayoutInflater .from(requireContext()).inflate(R .layout.dialog_error , null )
24
25
val builder = MaterialAlertDialogBuilder (requireContext()).setView(dialogView)
25
26
val alertDialog = builder.show()
26
27
27
28
dialogView.okButton.setOnClickListener {
28
29
alertDialog.dismiss()
30
+ throw RuntimeException (" Run Error" )
29
31
}
30
32
31
33
dialogView.exitButton.setOnClickListener {
@@ -35,7 +37,7 @@ class SearchFragment : Fragment(R.layout.fragment_search) {
35
37
36
38
companion object {
37
39
38
- fun newInstance (): Fragment = SearchFragment ()
40
+ fun newInstance (): Fragment = ErrorFragment ()
39
41
40
42
}
41
43
0 commit comments