Skip to content

Commit

Permalink
feat: 账号界面(测试)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim-shop committed May 25, 2023
1 parent 7ab559b commit 124a968
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/src/main/java/net/imshit/aircraftwar/gui/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 ->
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
</com.google.android.material.appbar.AppBarLayout>
Expand Down

0 comments on commit 124a968

Please sign in to comment.