diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-13 00:42:49 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-13 00:42:49 -0600 |
commit | 537b1553b53f79e1b0ab437ddc00b4a1fe34daa7 (patch) | |
tree | ff2c9ef257cede8ed70c999d7033a7d60e70bc4d /androidApp/src | |
parent | 430e643ec7aefd7a2bb51bc4d6dfa6c71cac42cd (diff) | |
download | etbsa-trackermap-mobile-537b1553b53f79e1b0ab437ddc00b4a1fe34daa7.tar.gz etbsa-trackermap-mobile-537b1553b53f79e1b0ab437ddc00b4a1fe34daa7.tar.bz2 etbsa-trackermap-mobile-537b1553b53f79e1b0ab437ddc00b4a1fe34daa7.zip |
Finished and redesigned UserInformationActivity and added About section
Diffstat (limited to 'androidApp/src')
4 files changed, 127 insertions, 4 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationActivity.kt index da1c0d5..cda8072 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationActivity.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationActivity.kt @@ -1,10 +1,14 @@ package mx.trackermap.TrackerMap.android.session import android.content.Intent +import android.content.pm.PackageManager +import android.net.Uri import android.os.Bundle import android.view.View import android.widget.Toast import androidx.appcompat.app.AppCompatActivity +import androidx.core.app.NavUtils +import mx.trackermap.TrackerMap.android.R import mx.trackermap.TrackerMap.android.databinding.UserInformationActivityBinding import mx.trackermap.TrackerMap.client.models.User import org.koin.androidx.viewmodel.ext.android.viewModel @@ -28,6 +32,16 @@ class UserInformationActivity : AppCompatActivity() { setupEvents() userInformationViewModel.fetchUserInfo() + + // Show version number + val pm = applicationContext.packageManager + val pkgName = applicationContext.packageName + try { + val pkgInfo = pm.getPackageInfo(pkgName, 0) + binding.appVersion.text = pkgInfo.versionName + } catch (e: PackageManager.NameNotFoundException) { + e.printStackTrace() + } } private fun setupObservers() { @@ -36,13 +50,20 @@ class UserInformationActivity : AppCompatActivity() { UserInformationViewModel.InformationState.Loading -> setLoading(true) UserInformationViewModel.InformationState.Failure -> failure() is UserInformationViewModel.InformationState.Success -> display(userInformation.user) - UserInformationViewModel.InformationState.Signout -> signout() + UserInformationViewModel.InformationState.Signout -> signOut() } } } private fun setupEvents() { + binding.backButton.setOnClickListener { onBackPressed() } binding.signoutButton.setOnClickListener { userInformationViewModel.signout() } + binding.sourceCodeButton.setOnClickListener { + openURL(getString(R.string.app_source_code_url)) + } + binding.websiteButton.setOnClickListener { + openURL(getString(R.string.app_website_url)) + } } private fun setLoading(isLoading: Boolean) { @@ -68,7 +89,13 @@ class UserInformationActivity : AppCompatActivity() { } } - private fun signout() { + private fun openURL(url: String) { + val uri = Uri.parse(url) + val intent = Intent(Intent.ACTION_VIEW, uri) + startActivity(intent) + } + + private fun signOut() { val intent = Intent(applicationContext, LoginActivity::class.java) intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK startActivity(intent) diff --git a/androidApp/src/main/res/drawable/about_logo.xml b/androidApp/src/main/res/drawable/about_logo.xml new file mode 100644 index 0000000..d905fa7 --- /dev/null +++ b/androidApp/src/main/res/drawable/about_logo.xml @@ -0,0 +1,71 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="180dp" + android:height="120dp" + android:viewportWidth="47.625" + android:viewportHeight="31.75"> + <path + android:pathData="M0,0h47.625v31.75h-47.625z" + android:strokeWidth="0.269399" + android:fillColor="#ffffff"/> + <path + android:pathData="M6.8531,17.8839L6.8531,17.1112L10.5715,17.1112L10.5715,17.8839L9.153,17.8839L9.153,21.3366L8.2777,21.3366L8.2777,17.8839Z" + android:fillColor="#000000" + android:strokeColor="#00000000"/> + <path + android:pathData="M10.7488,21.3366L10.7488,18.1917l0.827,0l0,0.3441q0.1509,-0.2052 0.3622,-0.3078 0.2173,-0.1087 0.4769,-0.1087 0.1207,0.006 0.1992,0.0241 0.0845,0.0121 0.1449,0.0483L12.7589,18.9161Q12.6683,18.8738 12.5597,18.8557 12.451,18.8316 12.3363,18.8316q-0.2415,0 -0.4467,0.1207 -0.1992,0.1207 -0.3139,0.3501l0,2.0342z" + android:fillColor="#000000" + android:strokeColor="#00000000"/> + <path + android:pathData="m14.1027,21.3909q-0.507,0 -0.827,-0.2656 -0.3199,-0.2716 -0.3199,-0.7002 0,-0.4467 0.3441,-0.7002 0.3441,-0.2535 0.9477,-0.2535 0.1932,0 0.3863,0.0302 0.1932,0.0302 0.3803,0.0905L15.0142,19.3688q0,-0.2716 -0.169,-0.4105 -0.169,-0.1388 -0.495,-0.1388 -0.1992,0 -0.4346,0.0664 -0.2294,0.0604 -0.5252,0.1932L13.0886,18.4694q0.3682,-0.169 0.7123,-0.2535 0.3501,-0.0845 0.6881,-0.0845 0.6338,0 0.9839,0.3078 0.3561,0.3018 0.3561,0.8571l0,2.0403l-0.8149,0l0,-0.2173q-0.1992,0.1388 -0.4225,0.2052 -0.2173,0.0664 -0.4889,0.0664zM13.7466,20.407q0,0.1811 0.1569,0.2897 0.1569,0.1026 0.4165,0.1026 0.2052,0 0.3742,-0.0483 0.1751,-0.0543 0.3199,-0.1509L15.0142,20.1294q-0.1509,-0.0604 -0.3199,-0.0845 -0.163,-0.0302 -0.3441,-0.0302 -0.2837,0 -0.4467,0.1087 -0.1569,0.1026 -0.1569,0.2837z" + android:fillColor="#000000" + android:strokeColor="#00000000"/> + <path + android:pathData="m17.9942,20.6726q0.2113,0 0.3924,-0.0845 0.1871,-0.0845 0.3561,-0.2656l0.495,0.5131q-0.2415,0.2656 -0.5795,0.4165 -0.338,0.1449 -0.7002,0.1449 -0.3441,0 -0.6519,-0.1268 -0.3018,-0.1268 -0.5252,-0.3441 -0.2173,-0.2173 -0.3441,-0.5131 -0.1268,-0.3018 -0.1268,-0.6459 0,-0.3441 0.1268,-0.6398 0.1268,-0.3018 0.3441,-0.5191 0.2233,-0.2233 0.5252,-0.3501 0.3078,-0.1268 0.6519,-0.1268 0.3742,0 0.7183,0.1509 0.3441,0.1449 0.5855,0.4105L18.7548,19.23Q18.5858,19.0428 18.3926,18.9463 18.1994,18.8497 17.9761,18.8497q-0.3561,0 -0.6036,0.2656 -0.2415,0.2656 -0.2415,0.6519 0,0.3863 0.2475,0.6459 0.2535,0.2596 0.6157,0.2596z" + android:fillColor="#000000" + android:strokeColor="#00000000"/> + <path + android:pathData="M19.6617,21.3366L19.6617,17.1112l0.827,-0.1811l0,2.5896l1.3582,-1.328l0.9356,0l-1.4728,1.4427 1.5634,1.7022L21.8167,21.3366L20.4887,19.9l0,1.4366z" + android:fillColor="#000000" + android:strokeColor="#00000000"/> + <path + android:pathData="m25.6756,20.9443q-0.2897,0.2354 -0.5976,0.3441 -0.3018,0.1087 -0.6761,0.1087 -0.3561,0 -0.67,-0.1268 -0.3078,-0.1268 -0.5372,-0.3441 -0.2233,-0.2173 -0.3561,-0.5131 -0.1268,-0.3018 -0.1268,-0.6459 0,-0.338 0.1207,-0.6338 0.1268,-0.3018 0.3441,-0.5191 0.2173,-0.2233 0.5131,-0.3501 0.3018,-0.1268 0.6398,-0.1268 0.332,0 0.6157,0.1328 0.2897,0.1268 0.495,0.3501 0.2113,0.2233 0.326,0.5372 0.1207,0.3078 0.1207,0.67l0,0.2173l-2.3421,0q0.0845,0.2958 0.326,0.4769 0.2415,0.1811 0.5674,0.1811 0.2052,0 0.3863,-0.0664 0.1811,-0.0664 0.3078,-0.1871zM24.3114,18.8195q-0.2837,0 -0.4889,0.1751 -0.2052,0.169 -0.2837,0.4588l1.5392,0Q24.9996,19.1756 24.7883,19.0006 24.5831,18.8195 24.3114,18.8195Z" + android:fillColor="#000000" + android:strokeColor="#00000000"/> + <path + android:pathData="M26.3936,21.3366L26.3936,18.1917l0.827,0l0,0.3441q0.1509,-0.2052 0.3622,-0.3078 0.2173,-0.1087 0.4769,-0.1087 0.1207,0.006 0.1992,0.0241 0.0845,0.0121 0.1449,0.0483L28.4036,18.9161Q28.3131,18.8738 28.2044,18.8557 28.0958,18.8316 27.9811,18.8316q-0.2415,0 -0.4467,0.1207 -0.1992,0.1207 -0.3139,0.3501l0,2.0342z" + android:fillColor="#000000" + android:strokeColor="#00000000"/> + <path + android:pathData="M31.1698,21.0348 L29.709,18.2279l0,3.1087L28.9001,21.3366L28.9001,17.1112l1.1227,0l1.159,2.2696 1.159,-2.2696l1.1227,0L33.4635,21.3366L32.6366,21.3366L32.6366,18.234Z" + android:fillColor="#ff3232" + android:strokeColor="#00000000"/> + <path + android:pathData="m35.1117,21.3909q-0.507,0 -0.827,-0.2656 -0.3199,-0.2716 -0.3199,-0.7002 0,-0.4467 0.3441,-0.7002 0.3441,-0.2535 0.9477,-0.2535 0.1932,0 0.3863,0.0302 0.1932,0.0302 0.3803,0.0905L36.0232,19.3688q0,-0.2716 -0.169,-0.4105 -0.169,-0.1388 -0.495,-0.1388 -0.1992,0 -0.4346,0.0664 -0.2294,0.0604 -0.5252,0.1932L34.0976,18.4694q0.3682,-0.169 0.7123,-0.2535 0.3501,-0.0845 0.6881,-0.0845 0.6338,0 0.9839,0.3078 0.3561,0.3018 0.3561,0.8571l0,2.0403l-0.8149,0l0,-0.2173q-0.1992,0.1388 -0.4225,0.2052 -0.2173,0.0664 -0.4889,0.0664zM34.7556,20.407q0,0.1811 0.1569,0.2897 0.1569,0.1026 0.4165,0.1026 0.2052,0 0.3742,-0.0483 0.1751,-0.0543 0.3199,-0.1509L36.0232,20.1294q-0.1509,-0.0604 -0.3199,-0.0845 -0.163,-0.0302 -0.3441,-0.0302 -0.2837,0 -0.4467,0.1087 -0.1569,0.1026 -0.1569,0.2837z" + android:fillColor="#ff3232" + android:strokeColor="#00000000"/> + <path + android:pathData="M37.464,22.5982L37.464,18.1917l0.8149,0l0,0.2596q0.1871,-0.1509 0.4165,-0.2233 0.2294,-0.0785 0.4769,-0.0785 0.332,0 0.6217,0.1268 0.2958,0.1268 0.5131,0.3441 0.2173,0.2173 0.338,0.5131 0.1268,0.2958 0.1268,0.6338 0,0.338 -0.1268,0.6338 -0.1268,0.2958 -0.3441,0.5131 -0.2173,0.2173 -0.5191,0.3441 -0.2958,0.1207 -0.6338,0.1207 -0.2294,0 -0.4527,-0.0604 -0.2173,-0.0664 -0.4044,-0.1871l0,1.4668zM39.0394,18.8557q-0.2233,0 -0.4165,0.0785 -0.1932,0.0724 -0.332,0.2173l0,1.2374q0.1328,0.1328 0.326,0.2113 0.1992,0.0785 0.4225,0.0785 0.3863,0 0.6519,-0.2596 0.2656,-0.2656 0.2656,-0.6519 0,-0.3863 -0.2716,-0.6459 -0.2656,-0.2656 -0.6459,-0.2656z" + android:fillColor="#ff3232" + android:strokeColor="#00000000"/> + <path + android:pathData="m27.0493,11.3526c1.6477,0.3218 2.2907,4.4853 2.2907,4.4853 0,0 -0.1211,-3.2368 -2.6164,-3.5685 -1.9916,-0.2647 -3.4171,2.3188 -3.4171,2.3188 0,0 2.1242,-3.5518 3.7428,-3.2356z" + android:strokeLineJoin="bevel" + android:strokeWidth="0.55385" + android:fillColor="#ff3232" + android:strokeColor="#ff3232" + android:strokeLineCap="butt"/> + <path + android:pathData="m27.5061,9.3425c1.6477,0.3218 2.2907,4.4853 2.2907,4.4853 0,0 -0.1211,-3.2368 -2.6164,-3.5685 -1.9916,-0.2647 -3.4171,2.3188 -3.4171,2.3188 0,0 2.1242,-3.5518 3.7428,-3.2356z" + android:strokeLineJoin="bevel" + android:strokeWidth="0.55385" + android:fillColor="#ff3232" + android:strokeColor="#ff3232" + android:strokeLineCap="butt"/> + <path + android:pathData="m27.9173,7.3325c1.6477,0.3218 2.2907,4.4853 2.2907,4.4853 0,0 -0.1211,-3.2368 -2.6164,-3.5685 -1.9916,-0.2647 -3.4171,2.3188 -3.4171,2.3188 0,0 2.1242,-3.5518 3.7428,-3.2356z" + android:strokeLineJoin="bevel" + android:strokeWidth="0.55385" + android:fillColor="#ff3232" + android:strokeColor="#ff3232" + android:strokeLineCap="butt"/> +</vector> diff --git a/androidApp/src/main/res/values-es-rMX/strings.xml b/androidApp/src/main/res/values-es-rMX/strings.xml index be656ad..a57d66a 100644 --- a/androidApp/src/main/res/values-es-rMX/strings.xml +++ b/androidApp/src/main/res/values-es-rMX/strings.xml @@ -85,10 +85,21 @@ <string name="event_unknown">Evento desconocido</string> <!-- User Information --> + <string name="user_details">Detalles de la cuenta</string> <string name="username">Nombre de usuario</string> <string name="email">Correo electrónico</string> <string name="unique_id">ID único</string> <string name="device_limit">Límite de dispositivos</string> <string name="admin">Administrador</string> <string name="sign_out">Cerrar sesión</string> + + <string name="about_details">Acerca de</string> + <string name="about_logo">Logo de TrackerMap</string> + <string name="about_text"> + TrackerMap es una aplicación de software libre para rastrear y gestionar dispositivos GPS en servidores de Traccar. + \n\nEl código fuente de TrackerMap está disponible bajo la licencia GNU General Public License versión 3. + </string> + <string name="app_version">Versión</string> + <string name="source_code">Código fuente</string> + <string name="open_website">Sitio web</string> </resources>
\ No newline at end of file diff --git a/androidApp/src/main/res/values/strings.xml b/androidApp/src/main/res/values/strings.xml index 7867873..e078b39 100644 --- a/androidApp/src/main/res/values/strings.xml +++ b/androidApp/src/main/res/values/strings.xml @@ -3,6 +3,9 @@ <string name="app_name">TrackerMap</string> <!-- Non translatable --> + <string name="app_website_url" translatable="false">https://trackermap.mx/</string> + <string name="app_source_code_url" translatable="false">https://sr.ht/~avalos/trackermap/</string> + <string name="maps_url_template" translatable="false"> https://www.google.com/maps/place/%1$f,%2$f?z=19 </string> @@ -100,10 +103,21 @@ <string name="event_unknown">Unknown event</string> <!-- User Information --> + <string name="user_details">Account details</string> <string name="username">Username</string> - <string name="email">Email</string> + <string name="email">E-mail</string> <string name="unique_id">Unique ID</string> - <string name="device_limit">Device Limit</string> + <string name="device_limit">Device limit</string> <string name="admin">Administrator</string> <string name="sign_out">Sign out</string> + + <string name="about_details">About</string> + <string name="about_logo">TrackerMap logo</string> + <string name="about_text"> + TrackerMap is a free (as in freedom) software app for tracking and managing GPS devices in Traccar servers. + \n\nTrackerMap source code is licensed under the GNU General Public License Version 3. + </string> + <string name="app_version">Version</string> + <string name="source_code">Source code</string> + <string name="open_website">Website</string> </resources> |