Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ...
- import kotlinx.android.synthetic.main.activity_main.*
- import kotlinx.android.synthetic.main.app_bar_main.*
- import kotlinx.android.synthetic.main.nav_header_main.*
- class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- val activityIntent: Intent
- // go straight to main if a token is stored
- if (!intent.hasExtra("email")) {
- activityIntent = Intent(this, LoginActivity::class.java)
- startActivity(activityIntent)
- finish()
- } else {
- setContentView(R.layout.activity_main)
- setSupportActionBar(toolbar)
- val toggle = ActionBarDrawerToggle(
- this, drawer_layout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close)
- drawer_layout.addDrawerListener(toggle)
- toggle.syncState()
- nav_view.setNavigationItemSelectedListener(this)
- email.text = intent.getStringExtra("email")
- }
- }
- ....
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement