diff options
Diffstat (limited to 'androidApp/src')
8 files changed, 155 insertions, 65 deletions
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 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="?attr/colorControlNormal"> + <path + android:fillColor="@android:color/white" + android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/> +</vector> 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 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="?attr/colorControlNormal"> + <path + android:fillColor="@android:color/white" + android:pathData="M10.09,15.59L11.5,17l5,-5 -5,-5 -1.41,1.41L12.67,11H3v2h9.67l-2.58,2.59zM19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/> +</vector> diff --git a/androidApp/src/main/res/layout/unit_map_fragment.xml b/androidApp/src/main/res/layout/unit_map_fragment.xml index abe31d8..3c7c059 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"> <RelativeLayout @@ -137,7 +139,6 @@ android:src="@drawable/position_datetime" app:tint="?android:textColorSecondary" /> - <TextView android:id="@+id/lastDate" android:layout_width="match_parent" @@ -166,6 +167,7 @@ android:layout_weight="1" android:text="@string/unit_details" android:textColor="@color/colorAccent" + android:textSize="12sp" style="?borderlessButtonStyle" /> <com.google.android.material.button.MaterialButton @@ -176,6 +178,7 @@ android:layout_weight="1" android:text="@string/unit_reports" android:textColor="@color/colorAccent" + android:textSize="12sp" style="?borderlessButtonStyle" /> <com.google.android.material.button.MaterialButton @@ -185,6 +188,7 @@ android:layout_weight="1" android:text="@string/unit_commands" android:textColor="@color/colorAccent" + android:textSize="12sp" style="?borderlessButtonStyle" /> </LinearLayout> 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 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout +<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/drawerLayout" android:layout_width="match_parent" android:layout_height="match_parent" - xmlns:app="http://schemas.android.com/apk/res-auto"> + tools:openDrawer="start"> - <FrameLayout - android:id="@+id/displayContainer" - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_marginTop="@dimen/fab_margin" - app:layout_constraintTop_toBottomOf="@id/displayModeToggle" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + <FrameLayout + android:id="@+id/displayContainer" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_marginTop="@dimen/fab_margin" + app:layout_constraintTop_toBottomOf="@id/displayModeToggle" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/profileButton" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintStart_toStartOf="parent" - android:backgroundTint="@android:color/white" - app:borderWidth="0dp" - app:fabSize="mini" - android:layout_marginStart="@dimen/fab_margin" - android:layout_marginTop="@dimen/fab_margin" - app:elevation="@dimen/fab_elevation" - android:src="@drawable/icon_menu" - android:contentDescription="@string/open_drawer"/> + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/drawerButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="parent" + android:backgroundTint="@android:color/white" + app:borderWidth="0dp" + app:fabSize="mini" + android:layout_marginStart="@dimen/fab_margin" + android:layout_marginTop="@dimen/fab_margin" + app:elevation="@dimen/fab_elevation" + android:src="@drawable/icon_menu" + android:contentDescription="@string/open_drawer"/> + + <com.google.android.material.card.MaterialCardView + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintTop_toTopOf="@id/displayModeToggle" + app:layout_constraintStart_toEndOf="@id/drawerButton" + app:layout_constraintEnd_toStartOf="@id/displayModeToggle" + app:layout_constraintBottom_toBottomOf="@id/displayModeToggle" + android:layout_marginVertical="@dimen/search_vertical_margin" + android:layout_marginHorizontal="@dimen/search_horizontal_margin" + app:cardCornerRadius="@dimen/card_border_radius" + app:cardElevation="@dimen/card_elevation"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/searchInput" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:hint="@string/units_search" + android:paddingHorizontal="16dp" + android:background="@null" + android:inputType="text" + android:lines="1" + android:imeOptions="actionSearch" /> - <com.google.android.material.card.MaterialCardView - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_constraintTop_toTopOf="@id/displayModeToggle" - app:layout_constraintStart_toEndOf="@id/profileButton" - app:layout_constraintEnd_toStartOf="@id/displayModeToggle" - app:layout_constraintBottom_toBottomOf="@id/displayModeToggle" - android:layout_marginVertical="@dimen/search_vertical_margin" - android:layout_marginHorizontal="@dimen/search_horizontal_margin" - app:cardCornerRadius="@dimen/card_border_radius" - app:cardElevation="@dimen/card_elevation"> + </com.google.android.material.card.MaterialCardView> - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/searchInput" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:hint="@string/units_search" - android:paddingHorizontal="16dp" - android:background="@null" - android:inputType="text" - android:lines="1" - android:imeOptions="actionSearch" /> + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/displayModeToggle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintEnd_toEndOf="parent" + android:backgroundTint="@android:color/white" + app:borderWidth="0dp" + app:fabSize="mini" + android:layout_marginEnd="@dimen/fab_margin" + android:layout_marginTop="@dimen/fab_margin" + app:elevation="@dimen/fab_elevation" + tools:ignore="ContentDescription" /> - </com.google.android.material.card.MaterialCardView> + </androidx.constraintlayout.widget.ConstraintLayout> - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/displayModeToggle" + <com.google.android.material.navigation.NavigationView + android:id="@+id/navigationView" android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintEnd_toEndOf="parent" - android:backgroundTint="@android:color/white" - app:borderWidth="0dp" - app:fabSize="mini" - android:layout_marginEnd="@dimen/fab_margin" - android:layout_marginTop="@dimen/fab_margin" - app:elevation="@dimen/fab_elevation" - tools:ignore="ContentDescription" /> + android:layout_height="match_parent" + android:layout_gravity="start" + app:menu="@menu/navigation_menu" /> -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file +</androidx.drawerlayout.widget.DrawerLayout>
\ 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + + <group + android:id="@+id/group_1" + android:checkableBehavior="single"> + <item + android:id="@+id/nav_account" + android:icon="@drawable/device_contact" + android:title="@string/menu_account" /> + <item + android:id="@+id/nav_about" + android:icon="@drawable/icon_about" + android:title="@string/menu_about" /> + </group> + + <group + android:id="@+id/group_2" + android:checkableBehavior="single"> + <item + android:id="@+id/nav_logout" + android:icon="@drawable/icon_logout" + android:title="@string/menu_logout" /> + </group> + +</menu>
\ 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 @@ <string name="toggle_map">Cambiar a mapa</string> <string name="open_drawer">Abrir menú lateral</string> + <string name="menu_account">Cuenta</string> + <string name="menu_about">Acerca de</string> + <string name="menu_logout">Cerrar sesión</string> + <!-- Unit Item --> <string name="unit_status_on">Estatus encendido</string> <string name="unit_status_off">Estatus apagado</string> 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 @@ <string name="toggle_map">Switch to map</string> <string name="open_drawer">Open drawer menu</string> + <string name="menu_account">Account</string> + <string name="menu_about">About</string> + <string name="menu_logout">Logout</string> + <!-- Unit Item --> <string name="unit_status_on">Status on</string> <string name="unit_status_off">Status off</string> |