| /* |
| * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
| */ |
| |
| package com.example.app |
| |
| import android.os.Bundle |
| import com.google.android.material.floatingactionbutton.FloatingActionButton |
| import androidx.appcompat.app.AppCompatActivity |
| import android.view.Menu |
| import android.view.MenuItem |
| import android.widget.TextView |
| import kotlinx.android.synthetic.main.activity_main.* |
| import kotlinx.android.synthetic.main.content_main.* |
| |
| class MainActivity : AppCompatActivity() { |
| |
| override fun onCreate(savedInstanceState: Bundle?) { |
| super.onCreate(savedInstanceState) |
| setContentView(R.layout.activity_main) |
| setSupportActionBar(toolbar) |
| setup(hello, fab) |
| } |
| |
| override fun onCreateOptionsMenu(menu: Menu): Boolean { |
| // Inflate the menu; this adds items to the action bar if it is present. |
| menuInflater.inflate(R.menu.menu_main, menu) |
| return true |
| } |
| |
| override fun onOptionsItemSelected(item: MenuItem): Boolean { |
| // Handle action bar item clicks here. The action bar will |
| // automatically handle clicks on the Home/Up button, so long |
| // as you specify a parent activity in AndroidManifest.xml. |
| val id = item.itemId |
| if (id == R.id.action_settings) return true |
| return super.onOptionsItemSelected(item) |
| } |
| } |
| |
| fun setup(hello: TextView, fab: FloatingActionButton) { |
| // placeholder |
| } |