Skip to content

Instantly share code, notes, and snippets.

@hieptl
Last active December 1, 2021 08:25
Show Gist options
  • Select an option

  • Save hieptl/795141edededcfd4a8f90fcc73e08c64 to your computer and use it in GitHub Desktop.

Select an option

Save hieptl/795141edededcfd4a8f90fcc73e08c64 to your computer and use it in GitHub Desktop.
CometChatUI.kt - Instagram Clone Android Kotlin
class CometChatUI : AppCompatActivity(), BottomNavigationView.OnNavigationItemSelectedListener, OnAlertDialogButtonClickListener {
private var loggedInUsername: TextView? = null
...
private fun initViewComponent() {
...
/* FeatureRestriction.isUserSettingsEnabled(object : FeatureRestriction.OnSuccessListener{
override fun onSuccess(p0: Boolean) {
userSettingsEnabled = p0
activityCometChatUnifiedBinding?.bottomNavigation?.menu?.findItem(R.id.menu_more)?.isVisible = p0
}
}) */
...
val user: User = CometChat.getLoggedInUser()
loggedInUsername = findViewById(R.id.loggedIn_userName);
loggedInUsername?.text = user.name
backIcon = findViewById(R.id.backIcon)
createGroup = findViewById(R.id.create_group)
more = findViewById(R.id.more);
}
...
private fun setUserClickListener() {
...
backIcon?.setOnClickListener(View.OnClickListener { finish() })
createGroup?.setOnClickListener(View.OnClickListener {
val intent = Intent(this@CometChatUI, CometChatCreateGroupActivity::class.java)
startActivity(intent)
})
more?.setOnClickListener(View.OnClickListener {
val intent = Intent(this@CometChatUI, UserProfileActivity::class.java)
startActivity(intent)
})
}
...
override fun onNavigationItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
...
/* R.id.menu_more -> {
fragment = CometChatUserProfile()
} */
...
}
...
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment