Using as a whole feature with the default settings

This is the quickest way to start using the Chat feature , all the default logic and navigations have already been defined.

Usage

Chat home page

Chat home page shows a list of the most recent chats.

Start an Activity

val chatIntent  = Intent(this, AmityChatHomePageActivity::class.java)
startActivity(chatIntent)

Create a Fragment

class MainActivity : AppCompatActivity(), IRecentChatItemClickListener {

   override fun onCreate(savedInstanceState: Bundle?) {
       super.onCreate(savedInstanceState)
       setContentView(R.layout.activity_main)

       val chatHomeFragment = AmityChatHomePageFragment.Builder()
       /**
         * set the listener to override recentItem click event
         * No Need to implement [IRecentChatClickListener] if you don't want to override click event
         */
       .recentChatItemClickListener(this)
       .build(this)
       
        val transaction = supportFragmentManager.beginTransaction()
        transaction.replace(R.id.fragmentContainer, chatHomeFragment)
        transaction.addToBackStack(null)
        transaction.commit()
   }
}

Last updated