diff options
author | Isidro Henoch <imhenoch@protonmail.com> | 2021-12-15 01:00:37 -0600 |
---|---|---|
committer | Isidro Henoch <imhenoch@protonmail.com> | 2021-12-15 01:00:37 -0600 |
commit | 547ce2e85e5b22e7c31f5a51df149919260d54b0 (patch) | |
tree | e31019661668becffb1931ad8da0eed1a96ce891 /androidApp/src/main/java/mx/trackermap | |
parent | ae8733682d89098348bd3d880f85028cb1bc2b6b (diff) | |
download | etbsa-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/main/java/mx/trackermap')
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt | 32 | ||||
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt | 8 |
2 files changed, 40 insertions, 0 deletions
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 |