View difference between Paste ID: MRLKzuKt and NUcNGRKW
SHOW: | | - or go back to the newest paste.
1
class MainActivity : AppCompatActivity() {
2
3-
    private lateinit var binds: ActivityMainBinding
3+
4
        super.onCreate(savedInstanceState)
5
6
        ActivityMainBinding.inflate(layoutInflater).apply {
7-
        binds = ActivityMainBinding.inflate(layoutInflater)
7+
            with(sCountry) {
8-
        setContentView(binds.root)
8+
                adapter =
9
                    ArrayAdapter(
10-
        val spinner = binds.sCountry
10+
                        this,
11-
        val adapter = ArrayAdapter(this,
11+
                        R.layout.item_country,
12-
            R.layout.item_country, R.id.tvCountry, OperatedCountry.values())
12+
                        R.id.tvCountry,
13-
        spinner.adapter = adapter
13+
                        OperatedCountry.values()
14
                    )
15-
        spinner.onItemSelectedListener = object :
15+
                onItemSelectedListener =
16-
            AdapterView.OnItemSelectedListener {
16+
                    object : AdapterView.OnItemSelectedListener {
17-
            override fun onItemSelected(parent: AdapterView<*>,
17+
                        override fun onItemSelected(
18-
                                        view: View, position: Int, id: Long) {
18+
                            parent: AdapterView<*>,
19
                            view: View?,
20
                            position: Int,
21
                            id: Long
22-
            override fun onNothingSelected(parent: AdapterView<*>) {
22+
                        ) {
23
                            if (view != null) {}
24
                        }
25
26
                        override fun onNothingSelected(parent: AdapterView<*>) {}
27
                    }
28
            }
29
30
            setContentView(binds.root)
31
        }
32-
enum class OperatedCountry (val countryCode: String, val icon: Int) {
32+
33
}
34
35
enum class OperatedCountry(val countryCode: String, val icon: Int) {
36-
}
36+
37
    UKRAINE("UK", R.drawable.flag_401),
38
    TURKEY("TR", R.drawable.flag_402),
39
}
40