diff --git a/app/src/main/java/net/imshit/aircraftwar/gui/MainActivity.kt b/app/src/main/java/net/imshit/aircraftwar/gui/MainActivity.kt index 4d9d4dd..857d0a6 100644 --- a/app/src/main/java/net/imshit/aircraftwar/gui/MainActivity.kt +++ b/app/src/main/java/net/imshit/aircraftwar/gui/MainActivity.kt @@ -1,5 +1,6 @@ package net.imshit.aircraftwar.gui +import android.content.DialogInterface import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import com.google.android.material.dialog.MaterialAlertDialogBuilder @@ -14,6 +15,23 @@ class MainActivity : AppCompatActivity() { with(ActivityMainBinding.inflate((layoutInflater))) { setContentView(root) + val listener = DialogInterface.OnClickListener { _, which -> + when (which) { + DialogInterface.BUTTON_POSITIVE -> TODO() + DialogInterface.BUTTON_NEGATIVE -> TODO() + DialogInterface.BUTTON_NEUTRAL -> TODO() + } + } + amTb.setNavigationOnClickListener { + MaterialAlertDialogBuilder(this@MainActivity) + .setTitle(R.string.dialog_login_title) + .setIcon(R.drawable.ic_login_24) + .setPositiveButton(android.R.string.ok, listener) + .setNeutralButton(R.string.dialog_login_button_register, listener) + .setNegativeButton(android.R.string.cancel, listener) + .setView(R.layout.dialog_login).show() + } + amTb.setOnMenuItemClickListener { item -> when (item.itemId) { R.id.item_about -> diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 56bda98..4c43bfb 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -19,6 +19,8 @@ app:menu="@menu/main" app:subtitle="@string/main_subtitle" app:subtitleCentered="true" + app:navigationContentDescription="@string/main_account" + app:navigationIcon="@drawable/ic_account_circle_24" app:title="@string/main_label" app:titleCentered="true" />