From 7734d6f38ec5835960493e8fc97edfe89f724105 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Tue, 11 Jan 2022 17:45:13 -0600 Subject: Implements base drawer layout menu --- .../TrackerMap/android/units/UnitsActivity.kt | 24 +++- androidApp/src/main/res/drawable/icon_about.xml | 10 ++ androidApp/src/main/res/drawable/icon_logout.xml | 10 ++ .../src/main/res/layout/unit_map_fragment.xml | 8 +- androidApp/src/main/res/layout/units_activity.xml | 134 ++++++++++++--------- androidApp/src/main/res/menu/navigation_menu.xml | 26 ++++ androidApp/src/main/res/values-es-rMX/strings.xml | 4 + androidApp/src/main/res/values/strings.xml | 4 + 8 files changed, 155 insertions(+), 65 deletions(-) create mode 100644 androidApp/src/main/res/drawable/icon_about.xml create mode 100644 androidApp/src/main/res/drawable/icon_logout.xml create mode 100644 androidApp/src/main/res/menu/navigation_menu.xml (limited to 'androidApp') diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt index 6bc7aab..9598077 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt @@ -2,6 +2,8 @@ package mx.trackermap.TrackerMap.android.units import android.os.Bundle import android.util.Log +import android.view.Gravity +import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.core.widget.doAfterTextChanged import androidx.fragment.app.commit @@ -36,11 +38,27 @@ class UnitsActivity : AppCompatActivity() { } private fun setupEvents() { - binding.profileButton.setOnClickListener { - Log.d("UnitsActivity", "Profile tapped") + binding.drawerButton.setOnClickListener { + binding.drawerLayout.openDrawer(Gravity.LEFT) + } + binding.navigationView.setNavigationItemSelectedListener { + when (it.itemId) { + R.id.nav_account -> { + Toast.makeText(this, "Account button tapped!", Toast.LENGTH_SHORT).show() + true + } + R.id.nav_about -> { + Toast.makeText(this, "About button tapped!", Toast.LENGTH_SHORT).show() + true + } + R.id.nav_logout -> { + Toast.makeText(this, "Logout button tapped!", Toast.LENGTH_SHORT).show() + true + } + else -> false + } } binding.displayModeToggle.setOnClickListener { - Log.d("UnitsActivity", "Units display toggle tapped") unitsViewModel.toggleDisplayMode() } binding.searchInput.doAfterTextChanged { diff --git a/androidApp/src/main/res/drawable/icon_about.xml b/androidApp/src/main/res/drawable/icon_about.xml new file mode 100644 index 0000000..17255b7 --- /dev/null +++ b/androidApp/src/main/res/drawable/icon_about.xml @@ -0,0 +1,10 @@ + + + diff --git a/androidApp/src/main/res/drawable/icon_logout.xml b/androidApp/src/main/res/drawable/icon_logout.xml new file mode 100644 index 0000000..83cdf05 --- /dev/null +++ b/androidApp/src/main/res/drawable/icon_logout.xml @@ -0,0 +1,10 @@ + + + diff --git a/androidApp/src/main/res/layout/unit_map_fragment.xml b/androidApp/src/main/res/layout/unit_map_fragment.xml index 6c2720b..9149fc6 100644 --- a/androidApp/src/main/res/layout/unit_map_fragment.xml +++ b/androidApp/src/main/res/layout/unit_map_fragment.xml @@ -26,7 +26,9 @@ app:cardUseCompatPadding="true" app:cardElevation="@dimen/card_elevation" app:cardCornerRadius="@dimen/card_border_radius" - app:contentPadding="@dimen/card_padding" + app:contentPaddingTop="@dimen/card_padding" + app:contentPaddingLeft="@dimen/card_padding" + app:contentPaddingRight="@dimen/card_padding" android:visibility="gone"> - diff --git a/androidApp/src/main/res/layout/units_activity.xml b/androidApp/src/main/res/layout/units_activity.xml index f0fd2ee..fb39ebe 100644 --- a/androidApp/src/main/res/layout/units_activity.xml +++ b/androidApp/src/main/res/layout/units_activity.xml @@ -1,73 +1,87 @@ - + tools:openDrawer="start"> - + + - + + + + + - + - + - + - + android:layout_height="match_parent" + android:layout_gravity="start" + app:menu="@menu/navigation_menu" /> - \ No newline at end of file + \ No newline at end of file diff --git a/androidApp/src/main/res/menu/navigation_menu.xml b/androidApp/src/main/res/menu/navigation_menu.xml new file mode 100644 index 0000000..2713776 --- /dev/null +++ b/androidApp/src/main/res/menu/navigation_menu.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/androidApp/src/main/res/values-es-rMX/strings.xml b/androidApp/src/main/res/values-es-rMX/strings.xml index 9429494..b55d7fd 100644 --- a/androidApp/src/main/res/values-es-rMX/strings.xml +++ b/androidApp/src/main/res/values-es-rMX/strings.xml @@ -12,6 +12,10 @@ Cambiar a mapa Abrir menú lateral + Cuenta + Acerca de + Cerrar sesión + Estatus encendido Estatus apagado diff --git a/androidApp/src/main/res/values/strings.xml b/androidApp/src/main/res/values/strings.xml index 0c6a29e..13ac79d 100644 --- a/androidApp/src/main/res/values/strings.xml +++ b/androidApp/src/main/res/values/strings.xml @@ -20,6 +20,10 @@ Switch to map Open drawer menu + Account + About + Logout + Status on Status off -- cgit v1.2.3