Skip to content

Commit 4a08b04

Browse files
author
Daniel García
committed
Merge branch 'release/1.1'
2 parents 23229ab + 9142370 commit 4a08b04

33 files changed

+566
-25
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#MacOS
2+
*.DS_STORE*
13
### Android ###
24
# Gradle files
35
.gradle/

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,35 @@ Write an Android Application using the json file provided as input that displays
1313

1414
### Prerequisites
1515

16-
N/A
16+
Install the latest version of Android studio and:
17+
- compileSdk 33
18+
- minSdk 21
19+
- gradle-7.3.3
20+
- emulator or device with min version DEVELOPER mode
21+
- make sure unsigned apks can be installed
22+
23+
IMPORTANT: You may use this app with WIFI connection
1724

1825
### Installation
1926

20-
N/A
27+
Clone repo and open it Android studio.
28+
Execute and install generated APK in the emulator or device
29+
OR
30+
Use "dist/demo.apk"
2131

2232
## Usage
2333

24-
TBD
34+
1. Conect to Wifi or any network
35+
2. Open the app and wait until load
36+
3. Main screen is the list of drivers assigned
37+
4. Tap over any driver to see details
38+
5. FAB is used to reload with specific settings
2539

2640

2741
## License
2842

2943
All rights reserved
44+
All images and brands are property of Platform Science INC, used as demo proposes.
3045

3146
## Contacts
3247

app/build.gradle

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@ plugins {
66
}
77

88
android {
9+
signingConfigs {
10+
prod {
11+
storeFile file('../dist/kesytore')
12+
storePassword 'platform'
13+
keyAlias 'psdks'
14+
keyPassword 'platform'
15+
}
16+
}
917
compileSdk 33
1018

1119
defaultConfig {
1220
applicationId "com.tripletres.platformscience"
1321
minSdk 21
1422
targetSdk 33
15-
versionCode 1
16-
versionName "1.0"
23+
versionCode 2
24+
versionName "1.1"
1725

1826
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1927
vectorDrawables {
@@ -30,6 +38,7 @@ android {
3038
release {
3139
minifyEnabled false
3240
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
41+
signingConfig signingConfigs.prod
3342
}
3443
}
3544
compileOptions {

app/debug/output-metadata.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": 3,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "com.tripletres.platformscience",
8+
"variantName": "debug",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"attributes": [],
14+
"versionCode": 2,
15+
"versionName": "1.1",
16+
"outputFile": "app-debug.apk"
17+
}
18+
],
19+
"elementType": "File"
20+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"formatVersion": 1,
3+
"database": {
4+
"version": 1,
5+
"identityHash": "b5f482a951d98ec838129eaf14a3af36",
6+
"entities": [
7+
{
8+
"tableName": "shipment_table",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`shipment_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `address` TEXT NOT NULL)",
10+
"fields": [
11+
{
12+
"fieldPath": "id",
13+
"columnName": "shipment_id",
14+
"affinity": "INTEGER",
15+
"notNull": true
16+
},
17+
{
18+
"fieldPath": "address",
19+
"columnName": "address",
20+
"affinity": "TEXT",
21+
"notNull": true
22+
}
23+
],
24+
"primaryKey": {
25+
"columnNames": [
26+
"shipment_id"
27+
],
28+
"autoGenerate": true
29+
},
30+
"indices": [],
31+
"foreignKeys": []
32+
},
33+
{
34+
"tableName": "driver_table",
35+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`driver_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `suitabilityScore` REAL, `shipment_id` INTEGER, `address` TEXT)",
36+
"fields": [
37+
{
38+
"fieldPath": "id",
39+
"columnName": "driver_id",
40+
"affinity": "INTEGER",
41+
"notNull": true
42+
},
43+
{
44+
"fieldPath": "name",
45+
"columnName": "name",
46+
"affinity": "TEXT",
47+
"notNull": true
48+
},
49+
{
50+
"fieldPath": "assignation.suitabilityScore",
51+
"columnName": "suitabilityScore",
52+
"affinity": "REAL",
53+
"notNull": false
54+
},
55+
{
56+
"fieldPath": "assignation.shipment.id",
57+
"columnName": "shipment_id",
58+
"affinity": "INTEGER",
59+
"notNull": false
60+
},
61+
{
62+
"fieldPath": "assignation.shipment.address",
63+
"columnName": "address",
64+
"affinity": "TEXT",
65+
"notNull": false
66+
}
67+
],
68+
"primaryKey": {
69+
"columnNames": [
70+
"driver_id"
71+
],
72+
"autoGenerate": true
73+
},
74+
"indices": [],
75+
"foreignKeys": []
76+
}
77+
],
78+
"views": [],
79+
"setupQueries": [
80+
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
81+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'b5f482a951d98ec838129eaf14a3af36')"
82+
]
83+
}
84+
}

app/src/main/java/com/tripletres/platformscience/domain/AssignDriversToShipmentsUseCase.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ package com.tripletres.platformscience.domain
22

33
import com.tripletres.platformscience.data.repo.DriverRepository
44
import com.tripletres.platformscience.data.repo.ShipmentRepository
5-
import com.tripletres.platformscience.domain.algorithm.AssignationAlgorithmType
6-
import com.tripletres.platformscience.domain.algorithm.BranchAndBoundAlgorithm
7-
import com.tripletres.platformscience.domain.algorithm.GreedyAssignationAlgorithm
8-
import com.tripletres.platformscience.domain.algorithm.IAssignationAlgorithm
5+
import com.tripletres.platformscience.domain.algorithm.*
96
import com.tripletres.platformscience.domain.model.*
107
import javax.inject.Inject
118

@@ -19,7 +16,7 @@ class AssignDriversToShipmentsUseCase @Inject constructor(
1916
) {
2017

2118
// Can be changed for your favorite algorithm
22-
private val defaultAlgorithm = AssignationAlgorithmType.GREEDY.name
19+
private val defaultAlgorithm = AssignationAlgorithmType.ANT_COLONY.name
2320

2421
suspend operator fun invoke(algorithm: String?): List<Driver> {
2522
val drivers = driverRepository.getDriversFromDB().asDriverList()
@@ -50,6 +47,7 @@ class AssignDriversToShipmentsUseCase @Inject constructor(
5047
return when (type.toAssignationAlgorithmType()) {
5148
AssignationAlgorithmType.GREEDY -> GreedyAssignationAlgorithm()
5249
AssignationAlgorithmType.BRANCH -> BranchAndBoundAlgorithm()
50+
AssignationAlgorithmType.ANT_COLONY -> AntColonyOptimizationAlgorithm()
5351
}
5452
}
5553

0 commit comments

Comments
 (0)