aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src
diff options
context:
space:
mode:
authorIsidro Henoch <imhenoch@protonmail.com>2021-12-15 01:00:37 -0600
committerIsidro Henoch <imhenoch@protonmail.com>2021-12-15 01:00:37 -0600
commit547ce2e85e5b22e7c31f5a51df149919260d54b0 (patch)
treee31019661668becffb1931ad8da0eed1a96ce891 /androidApp/src
parentae8733682d89098348bd3d880f85028cb1bc2b6b (diff)
downloadetbsa-trackermap-mobile-547ce2e85e5b22e7c31f5a51df149919260d54b0.tar.gz
etbsa-trackermap-mobile-547ce2e85e5b22e7c31f5a51df149919260d54b0.tar.bz2
etbsa-trackermap-mobile-547ce2e85e5b22e7c31f5a51df149919260d54b0.zip
Adds the details activity
Diffstat (limited to 'androidApp/src')
-rw-r--r--androidApp/src/main/AndroidManifest.xml3
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt32
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt8
-rw-r--r--androidApp/src/main/res/layout/details_activity.xml17
4 files changed, 60 insertions, 0 deletions
diff --git a/androidApp/src/main/AndroidManifest.xml b/androidApp/src/main/AndroidManifest.xml
index 889342f..5d56847 100644
--- a/androidApp/src/main/AndroidManifest.xml
+++ b/androidApp/src/main/AndroidManifest.xml
@@ -23,5 +23,8 @@
<activity
android:name=".units.UnitsActivity"
android:exported="false"/>
+ <activity
+ android:name=".details.DetailsActivity"
+ android:exported="false"/>
</application>
</manifest> \ No newline at end of file
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt
new file mode 100644
index 0000000..c9769e4
--- /dev/null
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt
@@ -0,0 +1,32 @@
+package mx.trackermap.TrackerMap.android.details
+
+import android.os.Bundle
+import android.util.Log
+import androidx.appcompat.app.AppCompatActivity
+import mx.trackermap.TrackerMap.android.databinding.DetailsActivityBinding
+
+class DetailsActivity: AppCompatActivity() {
+ private var _binding: DetailsActivityBinding? = null
+ private val binding get() = _binding!!
+
+ companion object {
+ val DEVICE_ID_EXTRA = "device_id"
+ val ACTION_EXTRA = "action"
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ _binding = DetailsActivityBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+
+ Log.d("DetailsActivity", "Device ID - ${intent.getIntExtra(DEVICE_ID_EXTRA, 0)}")
+ Log.d("DetailsActivity", "Device ID - ${intent.getSerializableExtra(ACTION_EXTRA)}")
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+
+ _binding = null
+ }
+} \ No newline at end of file
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt
index a3ed7a8..2c11dc2 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt
@@ -1,5 +1,6 @@
package mx.trackermap.TrackerMap.android.devices
+import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
@@ -9,6 +10,8 @@ import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.coroutines.DelicateCoroutinesApi
import mx.trackermap.TrackerMap.android.databinding.DevicesFragmentBinding
+import mx.trackermap.TrackerMap.android.details.DetailsActivity
+import mx.trackermap.TrackerMap.android.units.UnitsActivity
import mx.trackermap.TrackerMap.android.units.UnitsViewModel
import mx.trackermap.TrackerMap.client.models.UnitInformation
import org.koin.androidx.viewmodel.ext.android.viewModel
@@ -62,5 +65,10 @@ class DevicesFragment : Fragment() {
private fun itemAction(unit: UnitInformation, action: Action) {
Log.d("DevicesFragment", "Action: $action - Unit: $unit")
+ val activity = requireActivity()
+ val intent = Intent(activity.applicationContext, DetailsActivity::class.java)
+ intent.putExtra(DetailsActivity.DEVICE_ID_EXTRA, unit.device.id)
+ intent.putExtra(DetailsActivity.ACTION_EXTRA, action)
+ startActivity(intent)
}
} \ No newline at end of file
diff --git a/androidApp/src/main/res/layout/details_activity.xml b/androidApp/src/main/res/layout/details_activity.xml
new file mode 100644
index 0000000..1a50487
--- /dev/null
+++ b/androidApp/src/main/res/layout/details_activity.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ android:text="DETAILS"/>
+
+</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file