From 48817f90572abac9fea91cab719a46c51121ad22 Mon Sep 17 00:00:00 2001 From: Henrik Lepson Date: Fri, 15 Oct 2021 17:06:00 +0300 Subject: [PATCH] MOB-38 created basic menu layout, cur no actions --- .../mobileauthapp/MainActivity.kt | 24 +++++++++++++++++++ .../res/drawable/ic_baseline_language_24.xml | 10 ++++++++ .../app/src/main/res/drawable/ic_settings.xml | 10 ++++++++ .../app/src/main/res/layout/activity_main.xml | 20 ++++++++++++++-- MobileAuthApp/app/src/main/res/menu/menu.xml | 17 +++++++++++++ .../app/src/main/res/values/strings.xml | 7 +++++- .../app/src/main/res/values/themes.xml | 2 +- 7 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 MobileAuthApp/app/src/main/res/drawable/ic_baseline_language_24.xml create mode 100644 MobileAuthApp/app/src/main/res/drawable/ic_settings.xml create mode 100644 MobileAuthApp/app/src/main/res/menu/menu.xml diff --git a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/MainActivity.kt b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/MainActivity.kt index bc93c57..6b4c940 100644 --- a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/MainActivity.kt +++ b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/MainActivity.kt @@ -4,6 +4,9 @@ import android.nfc.NfcAdapter import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.util.Log +import android.view.Menu +import android.view.MenuItem +import android.widget.Toast import androidx.navigation.NavController import androidx.navigation.fragment.NavHostFragment import com.tarkvaraprojekt.mobileauthapp.databinding.ActivityMainBinding @@ -17,8 +20,29 @@ class MainActivity : AppCompatActivity() { val binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) + setSupportActionBar(binding.toolbar) + val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment navigationController = navHostFragment.navController } + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + menuInflater.inflate(R.menu.menu, menu) + return true + } + + override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) { + R.id.menu_language_option -> { + Toast.makeText(this, getString(R.string.menu_action_unavailable), Toast.LENGTH_SHORT) + .show() + true + } + R.id.menu_settings_option -> { + Toast.makeText(this, getString(R.string.menu_action_unavailable), Toast.LENGTH_SHORT) + .show() + true + } + else -> super.onOptionsItemSelected(item) + } + } \ No newline at end of file diff --git a/MobileAuthApp/app/src/main/res/drawable/ic_baseline_language_24.xml b/MobileAuthApp/app/src/main/res/drawable/ic_baseline_language_24.xml new file mode 100644 index 0000000..3f70646 --- /dev/null +++ b/MobileAuthApp/app/src/main/res/drawable/ic_baseline_language_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/MobileAuthApp/app/src/main/res/drawable/ic_settings.xml b/MobileAuthApp/app/src/main/res/drawable/ic_settings.xml new file mode 100644 index 0000000..41a82ed --- /dev/null +++ b/MobileAuthApp/app/src/main/res/drawable/ic_settings.xml @@ -0,0 +1,10 @@ + + + diff --git a/MobileAuthApp/app/src/main/res/layout/activity_main.xml b/MobileAuthApp/app/src/main/res/layout/activity_main.xml index 39c9655..fe72c5c 100644 --- a/MobileAuthApp/app/src/main/res/layout/activity_main.xml +++ b/MobileAuthApp/app/src/main/res/layout/activity_main.xml @@ -6,12 +6,28 @@ android:layout_height="match_parent" tools:context=".MainActivity"> + + + app:navGraph="@navigation/nav_graph" + app:layout_constraintTop_toBottomOf="@id/toolbar" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> \ No newline at end of file diff --git a/MobileAuthApp/app/src/main/res/menu/menu.xml b/MobileAuthApp/app/src/main/res/menu/menu.xml new file mode 100644 index 0000000..865a927 --- /dev/null +++ b/MobileAuthApp/app/src/main/res/menu/menu.xml @@ -0,0 +1,17 @@ + + + + + + + + \ No newline at end of file diff --git a/MobileAuthApp/app/src/main/res/values/strings.xml b/MobileAuthApp/app/src/main/res/values/strings.xml index 0274330..252888c 100644 --- a/MobileAuthApp/app/src/main/res/values/strings.xml +++ b/MobileAuthApp/app/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ - Mobile Authenticator + NFC authentication Work in progress ALUSTA @@ -31,4 +31,9 @@ %1$s %2$s ISIKUKOOD UNUSTA + + + Seaded + Keel + Toiming pole hetkel saadaval \ No newline at end of file diff --git a/MobileAuthApp/app/src/main/res/values/themes.xml b/MobileAuthApp/app/src/main/res/values/themes.xml index 7ce71ad..8572ef8 100644 --- a/MobileAuthApp/app/src/main/res/values/themes.xml +++ b/MobileAuthApp/app/src/main/res/values/themes.xml @@ -1,6 +1,6 @@ -