Created
June 29, 2020 18:40
-
-
Save jetaggart/a89a34fea02aad37ccb47750ed449f27 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // android/app/src/main/java/io/getstream/thestream/AuthedMainActivity.kt:8 | |
| class AuthedMainActivity : AppCompatActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_authed_main) | |
| val navigation = findViewById<BottomNavigationView>(R.id.navigation) | |
| navigation.setOnNavigationItemSelectedListener(navListener) | |
| addFragment(PeopleFragment()) | |
| } | |
| private fun addFragment(fragment: Fragment) { | |
| supportFragmentManager | |
| .beginTransaction() | |
| .setCustomAnimations( | |
| R.anim.design_bottom_sheet_slide_in, | |
| R.anim.design_bottom_sheet_slide_out | |
| ) | |
| .replace(R.id.content, fragment, fragment.javaClass.simpleName) | |
| .commit() | |
| } | |
| private val navListener = BottomNavigationView.OnNavigationItemSelectedListener { item -> | |
| when (item.itemId) { | |
| R.id.navigation_people -> { | |
| addFragment(PeopleFragment()) | |
| return@OnNavigationItemSelectedListener true | |
| } | |
| R.id.navigation_channels -> { | |
| addFragment(ChannelsFragment()) | |
| return@OnNavigationItemSelectedListener true | |
| } | |
| } | |
| false | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment