Created
June 18, 2022 10:54
-
-
Save Arunshaik2001/09cdf7d30c0da099446e2da9330cbb8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() , ProblemItemListener { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
val binding = ActivityMainBinding.inflate(layoutInflater) | |
setContentView(binding.root) | |
setTitle(R.string.app_name) | |
val problemList = binding.problemsList | |
val mode = binding.mode | |
mode.text = getString(R.string.app_title) | |
val list = listOf( | |
Problem(1, "Two Sum", false), | |
Problem(2, "Maximum Sub Array", false), | |
Problem(3, "Reverse Words", false), | |
Problem(4, "Min Stack", false), | |
Problem(5, "Edit Distance", false), | |
Problem(6, "Reverse Integer", false), | |
Problem(7, "Count and Say", false), | |
Problem(8, "Trapping Rain Water", false), | |
Problem(9, "Wildcard Matching", false), | |
) | |
problemList.adapter = ProblemsAdapter(list,this) | |
problemList.layoutManager = LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false) | |
} | |
override fun onItemClicked(item: Problem) { | |
Toast.makeText(this, "${item.problemNumber} : ${item.problemName}", Toast.LENGTH_LONG).show() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment