ogaclejapan / SmartTabLayout

A custom ViewPager title strip which gives continuous feedback to the user when scrolling
Apache License 2.0
7.09k stars 1.34k forks source link

Is this correct way to pass arguments in kotlin? #292

Open rajaasim opened 4 years ago

rajaasim commented 4 years ago

companion object{ fun newInstance(title: String) = FragmentChat().apply { arguments = Bundle().apply { putString("title", title) } } fun arguments(title: String): Bundle { return Bundler() .putString("title", title) .get() } }

override fun onAttach(context: Context?) { super.onAttach(context) callbacks = activity as OnFragmentCallbacks title = arguments?.getString("title") }

fragmentItems.add(FragmentPagerItem.of("Chat1", FragmentChat::class.java, FragmentChat.arguments("Chat1"))) adapter.notifyDataSetChanged()

It is working but i am still concerned as there is no kotlin way mentioned? Please respond ASAP

kartik1225 commented 3 years ago

any updates on this?