Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-020
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
O.V.B Sewmina
2022-020
Commits
ff5a18c3
Commit
ff5a18c3
authored
Nov 12, 2022
by
A.P.R.C. Abeyrathna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final Stage V1
parent
693d76c3
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
1016 additions
and
17 deletions
+1016
-17
app/build.gradle
app/build.gradle
+36
-0
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+13
-2
app/src/main/java/com/app/travelle/DataParser.java
app/src/main/java/com/app/travelle/DataParser.java
+97
-0
app/src/main/java/com/app/travelle/FetchURL.java
app/src/main/java/com/app/travelle/FetchURL.java
+79
-0
app/src/main/java/com/app/travelle/InitialMap.java
app/src/main/java/com/app/travelle/InitialMap.java
+2
-2
app/src/main/java/com/app/travelle/Login.java
app/src/main/java/com/app/travelle/Login.java
+2
-0
app/src/main/java/com/app/travelle/MainActivity.java
app/src/main/java/com/app/travelle/MainActivity.java
+14
-0
app/src/main/java/com/app/travelle/PointsParser.java
app/src/main/java/com/app/travelle/PointsParser.java
+95
-0
app/src/main/java/com/app/travelle/RetrieveBusMap.java
app/src/main/java/com/app/travelle/RetrieveBusMap.java
+2
-2
app/src/main/java/com/app/travelle/RouteActivity.java
app/src/main/java/com/app/travelle/RouteActivity.java
+84
-0
app/src/main/java/com/app/travelle/TaskLoadedCallback.java
app/src/main/java/com/app/travelle/TaskLoadedCallback.java
+9
-0
app/src/main/python/AL.py
app/src/main/python/AL.py
+362
-0
app/src/main/python/helpers.py
app/src/main/python/helpers.py
+133
-0
app/src/main/python/script.py
app/src/main/python/script.py
+5
-0
app/src/main/res/layout/activity_initial_map.xml
app/src/main/res/layout/activity_initial_map.xml
+17
-0
app/src/main/res/layout/activity_retrieve_bus_map.xml
app/src/main/res/layout/activity_retrieve_bus_map.xml
+1
-1
app/src/main/res/layout/route_activity.xml
app/src/main/res/layout/route_activity.xml
+20
-0
app/src/main/res/navigation/nav_graph2.xml
app/src/main/res/navigation/nav_graph2.xml
+28
-0
app/src/main/res/values-land/dimens.xml
app/src/main/res/values-land/dimens.xml
+2
-2
app/src/main/res/values-w1240dp/dimens.xml
app/src/main/res/values-w1240dp/dimens.xml
+2
-2
app/src/main/res/values-w600dp/dimens.xml
app/src/main/res/values-w600dp/dimens.xml
+2
-2
app/src/main/res/values/dimens.xml
app/src/main/res/values/dimens.xml
+2
-2
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+2
-0
app/src/main/res/values/themes.xml
app/src/main/res/values/themes.xml
+3
-0
build.gradle
build.gradle
+4
-2
No files found.
app/build.gradle
View file @
ff5a18c3
plugins
{
plugins
{
id
'com.android.application'
id
'com.android.application'
id
'com.chaquo.python'
id
'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
id
'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
id
'com.google.gms.google-services'
id
'com.google.gms.google-services'
}
}
apply
plugin:
'com.android.application'
apply
plugin:
'com.chaquo.python'
android
{
android
{
namespace
'com.app.travelle'
namespace
'com.app.travelle'
compileSdk
32
compileSdk
32
...
@@ -15,7 +23,35 @@ android {
...
@@ -15,7 +23,35 @@ android {
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
python
{
pip
{
install
"networkx"
install
"asyncio"
}
}
ndk
{
abiFilters
"armeabi-v7a"
,
"arm64-v8a"
,
"x86"
,
"x86_64"
}
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
python
{
buildPython
"C:/Users/Chamod Abeyrathna/AppData/Local/Programs/Python/Python39/python.exe"
}
python
{
version
"3.9"
}
sourceSets
{
main
{
setRoot
"src/main/"
python
.
srcDir
"src/main/python"
}
}
}
}
buildTypes
{
buildTypes
{
...
...
app/src/main/AndroidManifest.xml
View file @
ff5a18c3
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
android:supportsRtl=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.Travelle"
android:theme=
"@style/Theme.Travelle"
tools:targetApi=
"31"
>
tools:targetApi=
"31"
>
<!--
<!--
TODO: Before you run your application, you need a Google Maps API key.
TODO: Before you run your application, you need a Google Maps API key.
...
@@ -30,9 +29,13 @@
...
@@ -30,9 +29,13 @@
project's local.properties file (e.g. MAPS_API_KEY=Aiza...), and replace the
project's local.properties file (e.g. MAPS_API_KEY=Aiza...), and replace the
"YOUR_API_KEY" string in this file with "${MAPS_API_KEY}".
"YOUR_API_KEY" string in this file with "${MAPS_API_KEY}".
-->
-->
<meta-data
android:name=
"com.google.android.gms.version"
android:value=
"@integer/google_play_services_version"
/>
<meta-data
<meta-data
android:name=
"com.google.android.geo.API_KEY"
android:name=
"com.google.android.geo.API_KEY"
android:value=
"
YOUR_API_KEY
"
/>
android:value=
"
@string/google_maps_key
"
/>
<activity
<activity
android:name=
".RetrieveBusMap"
android:name=
".RetrieveBusMap"
...
@@ -73,11 +76,19 @@
...
@@ -73,11 +76,19 @@
<activity
<activity
android:name=
".MainActivity"
android:name=
".MainActivity"
android:exported=
"true"
>
android:exported=
"true"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</intent-filter>
<meta-data
android:name=
"android.app.lib_name"
android:value=
""
/>
</activity>
<activity
android:name=
".RouteActivity"
android:exported=
"false"
>
<meta-data
<meta-data
android:name=
"android.app.lib_name"
android:name=
"android.app.lib_name"
...
...
app/src/main/java/com/app/travelle/DataParser.java
0 → 100644
View file @
ff5a18c3
package
com.app.travelle
;
import
com.google.android.gms.maps.model.LatLng
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
/**
* Created by Vishal on 10/20/2018.
*/
public
class
DataParser
{
public
List
<
List
<
HashMap
<
String
,
String
>>>
parse
(
JSONObject
jObject
)
{
List
<
List
<
HashMap
<
String
,
String
>>>
routes
=
new
ArrayList
<>();
JSONArray
jRoutes
;
JSONArray
jLegs
;
JSONArray
jSteps
;
try
{
jRoutes
=
jObject
.
getJSONArray
(
"routes"
);
/** Traversing all routes */
for
(
int
i
=
0
;
i
<
jRoutes
.
length
();
i
++)
{
jLegs
=
((
JSONObject
)
jRoutes
.
get
(
i
)).
getJSONArray
(
"legs"
);
List
path
=
new
ArrayList
<>();
/** Traversing all legs */
for
(
int
j
=
0
;
j
<
jLegs
.
length
();
j
++)
{
jSteps
=
((
JSONObject
)
jLegs
.
get
(
j
)).
getJSONArray
(
"steps"
);
/** Traversing all steps */
for
(
int
k
=
0
;
k
<
jSteps
.
length
();
k
++)
{
String
polyline
=
""
;
polyline
=
(
String
)
((
JSONObject
)
((
JSONObject
)
jSteps
.
get
(
k
)).
get
(
"polyline"
)).
get
(
"points"
);
List
<
LatLng
>
list
=
decodePoly
(
polyline
);
/** Traversing all points */
for
(
int
l
=
0
;
l
<
list
.
size
();
l
++)
{
HashMap
<
String
,
String
>
hm
=
new
HashMap
<>();
hm
.
put
(
"lat"
,
Double
.
toString
((
list
.
get
(
l
)).
latitude
));
hm
.
put
(
"lng"
,
Double
.
toString
((
list
.
get
(
l
)).
longitude
));
path
.
add
(
hm
);
}
}
routes
.
add
(
path
);
}
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
}
return
routes
;
}
/**
* Method to decode polyline points
* Courtesy : https://jeffreysambells.com/2010/05/27/decoding-polylines-from-google-maps-direction-api-with-java
*/
private
List
<
LatLng
>
decodePoly
(
String
encoded
)
{
List
<
LatLng
>
poly
=
new
ArrayList
<>();
int
index
=
0
,
len
=
encoded
.
length
();
int
lat
=
0
,
lng
=
0
;
while
(
index
<
len
)
{
int
b
,
shift
=
0
,
result
=
0
;
do
{
b
=
encoded
.
charAt
(
index
++)
-
63
;
result
|=
(
b
&
0x1f
)
<<
shift
;
shift
+=
5
;
}
while
(
b
>=
0x20
);
int
dlat
=
((
result
&
1
)
!=
0
?
~(
result
>>
1
)
:
(
result
>>
1
));
lat
+=
dlat
;
shift
=
0
;
result
=
0
;
do
{
b
=
encoded
.
charAt
(
index
++)
-
63
;
result
|=
(
b
&
0x1f
)
<<
shift
;
shift
+=
5
;
}
while
(
b
>=
0x20
);
int
dlng
=
((
result
&
1
)
!=
0
?
~(
result
>>
1
)
:
(
result
>>
1
));
lng
+=
dlng
;
LatLng
p
=
new
LatLng
((((
double
)
lat
/
1
E5
)),
(((
double
)
lng
/
1
E5
)));
poly
.
add
(
p
);
}
return
poly
;
}
}
\ No newline at end of file
app/src/main/java/com/app/travelle/FetchURL.java
0 → 100644
View file @
ff5a18c3
package
com.app.travelle
;
import
android.content.Context
;
import
android.os.AsyncTask
;
import
android.util.Log
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
/**
* Created by Vishal on 10/20/2018.
*/
public
class
FetchURL
extends
AsyncTask
<
String
,
Void
,
String
>
{
Context
mContext
;
String
directionMode
=
"driving"
;
public
FetchURL
(
Context
mContext
)
{
this
.
mContext
=
mContext
;
}
@Override
protected
String
doInBackground
(
String
...
strings
)
{
// For storing data from web service
String
data
=
""
;
directionMode
=
strings
[
1
];
try
{
// Fetching the data from web service
data
=
downloadUrl
(
strings
[
0
]);
Log
.
d
(
"mylog"
,
"Background task data "
+
data
.
toString
());
}
catch
(
Exception
e
)
{
Log
.
d
(
"Background Task"
,
e
.
toString
());
}
return
data
;
}
@Override
protected
void
onPostExecute
(
String
s
)
{
super
.
onPostExecute
(
s
);
PointsParser
parserTask
=
new
PointsParser
(
mContext
,
directionMode
);
// Invokes the thread for parsing the JSON data
parserTask
.
execute
(
s
);
}
private
String
downloadUrl
(
String
strUrl
)
throws
IOException
{
String
data
=
""
;
InputStream
iStream
=
null
;
HttpURLConnection
urlConnection
=
null
;
try
{
URL
url
=
new
URL
(
strUrl
);
// Creating an http connection to communicate with url
urlConnection
=
(
HttpURLConnection
)
url
.
openConnection
();
// Connecting to url
urlConnection
.
connect
();
// Reading data from url
iStream
=
urlConnection
.
getInputStream
();
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
iStream
));
StringBuffer
sb
=
new
StringBuffer
();
String
line
=
""
;
while
((
line
=
br
.
readLine
())
!=
null
)
{
sb
.
append
(
line
);
}
data
=
sb
.
toString
();
Log
.
d
(
"mylog"
,
"Downloaded URL: "
+
data
.
toString
());
br
.
close
();
}
catch
(
Exception
e
)
{
Log
.
d
(
"mylog"
,
"Exception downloading URL: "
+
e
.
toString
());
}
finally
{
iStream
.
close
();
urlConnection
.
disconnect
();
}
return
data
;
}
}
app/src/main/java/com/app/travelle/InitialMap.java
View file @
ff5a18c3
...
@@ -43,7 +43,7 @@ public class InitialMap extends AppCompatActivity {
...
@@ -43,7 +43,7 @@ public class InitialMap extends AppCompatActivity {
"Viharamahadevi Park"
,
"House Of Fashion"
,
"Castle Street"
,
"Rajagiriya"
,
"HSBC Rajagiriya"
,
"Ethulkotte New"
,
"Parliament Junction"
,
"Battaramulla Junction"
,
"Ganahena"
,
"Koswatta"
,
"Kotte-Bope"
"Viharamahadevi Park"
,
"House Of Fashion"
,
"Castle Street"
,
"Rajagiriya"
,
"HSBC Rajagiriya"
,
"Ethulkotte New"
,
"Parliament Junction"
,
"Battaramulla Junction"
,
"Ganahena"
,
"Koswatta"
,
"Kotte-Bope"
,
"Thalahena Junction"
,
"Malabe"
,
"Fort_TR"
,
"Kompannavidiya_TR"
,
"Kollupitiya_TR"
,
"Bambalapitiya_TR"
,
"Wellawatte_TR"
,
"Dehiwala_TR"
,
"Thalahena Junction"
,
"Malabe"
,
"Fort_TR"
,
"Kompannavidiya_TR"
,
"Kollupitiya_TR"
,
"Bambalapitiya_TR"
,
"Wellawatte_TR"
,
"Dehiwala_TR"
};
};
//Initialize variable
//Initialize variable
SupportMapFragment
supportMapFragment
;
SupportMapFragment
supportMapFragment
;
FusedLocationProviderClient
client
;
FusedLocationProviderClient
client
;
GoogleMap
map
;
GoogleMap
map
;
...
@@ -166,4 +166,4 @@ public class InitialMap extends AppCompatActivity {
...
@@ -166,4 +166,4 @@ public class InitialMap extends AppCompatActivity {
}
}
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/app/travelle/Login.java
View file @
ff5a18c3
...
@@ -7,6 +7,7 @@ import android.os.Bundle;
...
@@ -7,6 +7,7 @@ import android.os.Bundle;
import
android.view.View
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.Toast
;
public
class
Login
extends
AppCompatActivity
{
public
class
Login
extends
AppCompatActivity
{
private
Button
login_btn
;
private
Button
login_btn
;
...
@@ -37,6 +38,7 @@ public class Login extends AppCompatActivity {
...
@@ -37,6 +38,7 @@ public class Login extends AppCompatActivity {
});
});
}
}
public
void
openWelcome
(){
public
void
openWelcome
(){
Toast
.
makeText
(
this
,
"This is from login"
,
Toast
.
LENGTH_SHORT
).
show
();
Intent
intent
=
new
Intent
(
this
,
InitialMap
.
class
);
Intent
intent
=
new
Intent
(
this
,
InitialMap
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
...
...
app/src/main/java/com/app/travelle/MainActivity.java
View file @
ff5a18c3
...
@@ -11,6 +11,10 @@ import android.view.Window;
...
@@ -11,6 +11,10 @@ import android.view.Window;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.Button
;
import
android.widget.Button
;
import
com.chaquo.python.PyObject
;
import
com.chaquo.python.Python
;
import
com.chaquo.python.android.AndroidPlatform
;
public
class
MainActivity
extends
AppCompatActivity
{
public
class
MainActivity
extends
AppCompatActivity
{
private
Button
button
;
private
Button
button
;
...
@@ -31,6 +35,16 @@ public class MainActivity extends AppCompatActivity {
...
@@ -31,6 +35,16 @@ public class MainActivity extends AppCompatActivity {
openLogin
();
openLogin
();
}
}
});
});
if
(!
Python
.
isStarted
())
{
Python
.
start
(
new
AndroidPlatform
(
this
));
}
Python
py
=
Python
.
getInstance
();
PyObject
pyobj
=
py
.
getModule
(
"AL"
);
//PyObject obj = pyobj.callAttr("get_nearest_station",6.902641300889514, 79.89708871696563);
PyObject
obj
=
pyobj
.
callAttr
(
"main"
,
1
,
2
,
6
);
System
.
out
.
println
(
obj
.
toString
());
}
}
public
void
openLogin
(){
public
void
openLogin
(){
Intent
intent
=
new
Intent
(
this
,
Login
.
class
);
Intent
intent
=
new
Intent
(
this
,
Login
.
class
);
...
...
app/src/main/java/com/app/travelle/PointsParser.java
0 → 100644
View file @
ff5a18c3
package
com.app.travelle
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.os.AsyncTask
;
import
android.util.Log
;
import
com.google.android.gms.maps.model.LatLng
;
import
com.google.android.gms.maps.model.PolylineOptions
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
/**
* Created by Vishal on 10/20/2018.
*/
public
class
PointsParser
extends
AsyncTask
<
String
,
Integer
,
List
<
List
<
HashMap
<
String
,
String
>>>>
{
TaskLoadedCallback
taskCallback
;
String
directionMode
=
"driving"
;
public
PointsParser
(
Context
mContext
,
String
directionMode
)
{
this
.
taskCallback
=
(
TaskLoadedCallback
)
mContext
;
this
.
directionMode
=
directionMode
;
}
// Parsing the data in non-ui thread
@Override
protected
List
<
List
<
HashMap
<
String
,
String
>>>
doInBackground
(
String
...
jsonData
)
{
JSONObject
jObject
;
List
<
List
<
HashMap
<
String
,
String
>>>
routes
=
null
;
try
{
jObject
=
new
JSONObject
(
jsonData
[
0
]);
Log
.
d
(
"mylog"
,
jsonData
[
0
].
toString
());
DataParser
parser
=
new
DataParser
();
Log
.
d
(
"mylog"
,
parser
.
toString
());
// Starts parsing data
routes
=
parser
.
parse
(
jObject
);
Log
.
d
(
"mylog"
,
"Executing routes"
);
Log
.
d
(
"mylog"
,
routes
.
toString
());
}
catch
(
Exception
e
)
{
Log
.
d
(
"mylog"
,
e
.
toString
());
e
.
printStackTrace
();
}
return
routes
;
}
// Executes in UI thread, after the parsing process
@Override
protected
void
onPostExecute
(
List
<
List
<
HashMap
<
String
,
String
>>>
result
)
{
ArrayList
<
LatLng
>
points
;
PolylineOptions
lineOptions
=
null
;
// Traversing through all the routes
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++)
{
points
=
new
ArrayList
<>();
lineOptions
=
new
PolylineOptions
();
// Fetching i-th route
List
<
HashMap
<
String
,
String
>>
path
=
result
.
get
(
i
);
// Fetching all the points in i-th route
for
(
int
j
=
0
;
j
<
path
.
size
();
j
++)
{
HashMap
<
String
,
String
>
point
=
path
.
get
(
j
);
double
lat
=
Double
.
parseDouble
(
point
.
get
(
"lat"
));
double
lng
=
Double
.
parseDouble
(
point
.
get
(
"lng"
));
LatLng
position
=
new
LatLng
(
lat
,
lng
);
points
.
add
(
position
);
}
// Adding all the points in the route to LineOptions
lineOptions
.
addAll
(
points
);
if
(
directionMode
.
equalsIgnoreCase
(
"walking"
))
{
lineOptions
.
width
(
10
);
lineOptions
.
color
(
Color
.
MAGENTA
);
}
else
{
lineOptions
.
width
(
20
);
lineOptions
.
color
(
Color
.
BLUE
);
}
Log
.
d
(
"mylog"
,
"onPostExecute lineoptions decoded"
);
}
// Drawing polyline in the Google Map for the i-th route
if
(
lineOptions
!=
null
)
{
//mMap.addPolyline(lineOptions);
taskCallback
.
onTaskDone
(
lineOptions
);
}
else
{
Log
.
d
(
"mylog"
,
"without Polylines drawn"
);
}
}
}
app/src/main/java/com/app/travelle/RetrieveBusMap.java
View file @
ff5a18c3
...
@@ -116,7 +116,7 @@ public class RetrieveBusMap extends FragmentActivity implements OnMapReadyCallba
...
@@ -116,7 +116,7 @@ public class RetrieveBusMap extends FragmentActivity implements OnMapReadyCallba
}
}
@Override
@Override
public
void
onCancelled
(
@NonNull
DatabaseError
databaseError
)
{
public
void
onCancelled
(
@NonNull
DatabaseError
databaseError
)
{
...
@@ -125,4 +125,4 @@ public class RetrieveBusMap extends FragmentActivity implements OnMapReadyCallba
...
@@ -125,4 +125,4 @@ public class RetrieveBusMap extends FragmentActivity implements OnMapReadyCallba
}
}
}
}
\ No newline at end of file
app/src/main/java/com/app/travelle/RouteActivity.java
0 → 100644
View file @
ff5a18c3
//package com.app.travelle;
//
//import androidx.annotation.NonNull;
//import androidx.annotation.Nullable;
//import androidx.appcompat.app.ActionBar;
//import androidx.appcompat.app.AppCompatActivity;
//
//import android.annotation.SuppressLint;
//import android.content.Intent;
//import android.os.Bundle;
//import android.util.Log;
//import android.view.View;
//import android.view.Window;
//import android.view.WindowManager;
//import android.widget.Button;
//
//import com.chaquo.python.PyObject;
//import com.chaquo.python.Python;
//import com.chaquo.python.android.AndroidPlatform;
//import com.google.android.gms.maps.GoogleMap;
//import com.google.android.gms.maps.MapFragment;
//import com.google.android.gms.maps.OnMapReadyCallback;
//import com.google.android.gms.maps.model.LatLng;
//import com.google.android.gms.maps.model.MarkerOptions;
//import com.google.android.gms.maps.model.Polyline;
//import com.google.android.gms.maps.model.PolylineOptions;
//
//public class RouteActivity extends AppCompatActivity implements OnMapReadyCallback, TaskLoadedCallback {
//
// private GoogleMap mMap;
// private MarkerOptions place1, place2;
// Button getDirection;
// private Polyline currentPolyline;
//
// @Override
// protected void onCreate(@Nullable Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.route_activity);
// getDirection = findViewById(R.id.btnGetDirection);
//
// MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.mapsFrag);
// mapFragment.getMapAsync(this);
//
// //27.658143,85.3199503
// //27.667491,85.3208583
// place1 = new MarkerOptions().position(new LatLng(6.911025392217044, 79.84855826417153)).title("Location 1");
// place2 = new MarkerOptions().position(new LatLng(6.903962700873259, 79.95430199947661)).title("Location 2");
// String url = getUrl(place1.getPosition(), place2.getPosition(), "driving");
// new FetchURL(RouteActivity.this).execute(getUrl(place1.getPosition(), place2.getPosition(), "driving"), "driving");
//
// }
//
//
// @Override
// public void onMapReady(@NonNull GoogleMap googleMap) {
// mMap = googleMap;
// Log.d("mylog", "Added Markers");
// mMap.addMarker(place1);
// mMap.addMarker(place2);
// }
// private String getUrl(LatLng origin, LatLng dest, String directionMode) {
// // Origin of route
// String str_origin = "origin=" + origin.latitude + "," + origin.longitude;
// // Destination of route
// String str_dest = "destination=" + dest.latitude + "," + dest.longitude;
// // Mode
// String mode = "mode=" + directionMode;
// // Building the parameters to the web service
// String parameters = str_origin + "&" + str_dest + "&" + mode;
// // Output format
// String output = "json";
// // Building the url to the web service
// String url = "https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters + "&key=" + getString(R.string.google_maps_key);
// return url;
// }
//
//
// @Override
// public void onTaskDone(Object... values) {
// if (currentPolyline != null)
// currentPolyline.remove();
// currentPolyline = mMap.addPolyline((PolylineOptions) values[0]);
// }
//}
\ No newline at end of file
app/src/main/java/com/app/travelle/TaskLoadedCallback.java
0 → 100644
View file @
ff5a18c3
package
com.app.travelle
;
/**
* Created by Vishal on 10/20/2018.
*/
public
interface
TaskLoadedCallback
{
void
onTaskDone
(
Object
...
values
);
}
app/src/main/python/AL.py
0 → 100644
View file @
ff5a18c3
#from asyncio.windows_events import NULL
from
cmath
import
inf
from
tokenize
import
ContStr
#from turtle import distance
from
helpers
import
load_map_test
,
load_map_bus
,
load_map_train
,
route_177
,
route_176
,
route_8717
from
math
import
radians
,
cos
,
sin
,
asin
,
sqrt
class
PathPlanner
():
def
__init__
(
self
,
M
,
start
=
None
,
goal
=
None
,
type
=
None
):
self
.
map
=
M
self
.
start
=
start
self
.
goal
=
goal
self
.
type
=
type
self
.
range
=
0
self
.
cost
=
0
self
.
allRoutes
=
[
177
,
176
,
8717
]
self
.
closedSet
=
self
.
create_closedSet
()
if
goal
!=
None
and
start
!=
None
else
None
self
.
openSet
=
self
.
create_openSet
()
if
goal
!=
None
and
start
!=
None
else
None
self
.
cameFrom
=
self
.
create_cameFrom
()
if
goal
!=
None
and
start
!=
None
else
None
self
.
gScore
=
self
.
create_gScore
()
if
goal
!=
None
and
start
!=
None
else
None
self
.
fScore
=
self
.
create_fScore
()
if
goal
!=
None
and
start
!=
None
else
None
self
.
path
=
self
.
run_search
()
if
self
.
map
and
self
.
start
!=
None
and
self
.
goal
!=
None
else
None
def
reconstruct_path
(
self
,
current
):
total_path
=
[
current
]
while
current
in
self
.
cameFrom
.
keys
():
current
=
self
.
cameFrom
[
current
]
total_path
.
append
(
current
)
return
total_path
def
_reset
(
self
):
self
.
closedSet
=
None
self
.
openSet
=
None
self
.
cameFrom
=
None
self
.
gScore
=
None
self
.
fScore
=
None
self
.
path
=
self
.
run_search
()
if
self
.
map
and
self
.
start
and
self
.
goal
else
None
def
run_search
(
self
):
""" """
if
self
.
map
==
None
:
raise
(
ValueError
,
"Must create map before running search"
)
if
self
.
goal
==
None
:
raise
(
ValueError
,
"Must create goal node before running search"
)
if
self
.
start
==
None
:
raise
(
ValueError
,
"Must create start node before running search"
)
self
.
closedSet
=
self
.
closedSet
if
self
.
closedSet
!=
None
else
self
.
create_closedSet
()
self
.
openSet
=
self
.
openSet
if
self
.
openSet
!=
None
else
self
.
create_openSet
()
self
.
cameFrom
=
self
.
cameFrom
if
self
.
cameFrom
!=
None
else
self
.
create_cameFrom
()
self
.
gScore
=
self
.
gScore
if
self
.
gScore
!=
None
else
self
.
create_gScore
()
self
.
fScore
=
self
.
fScore
if
self
.
fScore
!=
None
else
self
.
create_fScore
()
while
not
self
.
is_open_empty
():
current
=
self
.
get_current_node
()
if
current
==
self
.
goal
:
self
.
path
=
[
x
for
x
in
reversed
(
self
.
reconstruct_path
(
current
))]
return
self
.
path
else
:
self
.
openSet
.
remove
(
current
)
self
.
closedSet
.
add
(
current
)
for
neighbor
in
self
.
get_neighbors
(
current
):
if
neighbor
in
self
.
closedSet
:
continue
# Ignore the neighbor which is already evaluated.
if
not
neighbor
in
self
.
openSet
:
# Discover a new node
self
.
openSet
.
add
(
neighbor
)
# The distance from start to a neighbor
if
self
.
getTempGScore
(
current
,
neighbor
)
>=
self
.
get_gScore
(
neighbor
):
continue
# This path is the best until now. Record it!
self
.
record_best_path_to
(
current
,
neighbor
)
#self.range += self.dis
self
.
path
=
None
return
False
def
create_closedSet
(
self
):
return
set
()
def
create_openSet
(
self
):
openSet
=
set
()
openSet
.
add
(
self
.
start
)
return
openSet
def
create_cameFrom
(
self
):
cameFrom
=
{}
return
cameFrom
def
create_gScore
(
self
):
gScore
=
{}
for
node
in
self
.
map
.
intersections
.
keys
():
if
node
==
self
.
start
:
gScore
[
node
]
=
0
else
:
gScore
[
node
]
=
float
(
'inf'
)
return
gScore
def
create_fScore
(
self
):
if
self
.
start
!=
None
:
fScore
=
{}
for
node
in
self
.
map
.
intersections
.
keys
():
if
node
==
self
.
start
:
fScore
[
node
]
=
self
.
heuristic_cost_estimate
(
self
.
start
)
else
:
fScore
[
node
]
=
float
(
'inf'
)
return
fScore
raise
(
ValueError
,
"Must create start node before creating fScore."
)
def
set_map
(
self
,
M
):
"set map attribute "
self
.
_reset
(
self
)
self
.
start
=
None
self
.
goal
=
None
self
.
map
=
M
def
set_start
(
self
,
start
):
" set start attribute "
self
.
_reset
(
self
)
self
.
start
=
start
self
.
goal
=
None
def
set_goal
(
self
,
goal
):
"set goal attribute "
self
.
_reset
(
self
)
self
.
goal
=
goal
#-------------------------------- get information --------------------------------#
def
is_open_empty
(
self
):
"returns True if the open set is empty"
return
not
bool
(
self
.
openSet
)
def
get_current_node
(
self
):
" Returns the node in the open set with the lowest value of f(node)"
current
=
None
minim
=
float
(
'inf'
)
for
node
in
self
.
openSet
:
if
self
.
fScore
[
node
]
<
minim
:
minim
=
self
.
fScore
[
node
]
current
=
node
return
current
def
get_neighbors
(
self
,
node
):
"""Returns the neighbors of a node"""
return
set
(
self
.
map
.
roads
[
node
])
#-------------------------------- Calculations --------------------------------#
def
get_gScore
(
self
,
node
):
return
self
.
gScore
[
node
]
def
getTempGScore
(
self
,
current
,
neighbor
):
# distance from the current node to it's neighbors
g_score_current
=
self
.
get_gScore
(
current
)
dist_current_neighbor
=
self
.
distance
(
current
,
neighbor
)
return
g_score_current
+
dist_current_neighbor
def
heuristic_cost_estimate
(
self
,
node
):
if
self
.
goal
!=
None
:
heuristic_estimate
=
self
.
distance
(
node
,
self
.
goal
)
return
heuristic_estimate
raise
(
ValueError
,
"Must create goal node before calculating huristic "
)
def
calculate_fscore
(
self
,
node
):
# F = G + H
f_score
=
self
.
get_gScore
(
node
)
+
self
.
heuristic_cost_estimate
(
node
)
return
f_score
# best path
def
record_best_path_to
(
self
,
current
,
neighbor
):
self
.
cameFrom
[
neighbor
]
=
current
self
.
gScore
[
neighbor
]
=
self
.
getTempGScore
(
current
,
neighbor
)
self
.
fScore
[
neighbor
]
=
self
.
gScore
[
neighbor
]
+
self
.
heuristic_cost_estimate
(
neighbor
)
def
distance
(
self
,
node_1
,
node_2
):
#The math module contains a function named
#radians which converts from degrees to radians.
lon1
=
radians
(
self
.
map
.
intersections
[
node_1
][
0
])
lon2
=
radians
(
self
.
map
.
intersections
[
node_2
][
0
])
lat1
=
radians
(
self
.
map
.
intersections
[
node_1
][
1
])
lat2
=
radians
(
self
.
map
.
intersections
[
node_2
][
1
])
# Haversine formula
dlon
=
lon2
-
lon1
dlat
=
lat2
-
lat1
a
=
sin
(
dlat
/
2
)
**
2
+
cos
(
lat1
)
*
cos
(
lat2
)
*
sin
(
dlon
/
2
)
**
2
c
=
2
*
asin
(
sqrt
(
a
))
# Radius of earth in kilometers. Use 3956 for miles
r
=
6371
# calculate the result
dist
=
(
c
*
r
)
#print (dist)
#self.dis = dist
return
dist
def
get_traveled_distance
(
self
):
#traveled_distance
lastNode
=
self
.
start
for
n
in
self
.
path
[
1
:]:
self
.
range
+=
distance
(
lastNode
,
n
)
lastNode
=
n
return
self
.
range
def
get_fare
(
self
,
path
):
routeNumbers
=
[]
for
each
in
path
:
routeNumbers
.
append
(
self
.
map
.
routeNo
[
each
])
#routeNumbers
for
n
in
self
.
allRoutes
:
val
=
routeNumbers
.
count
(
n
)
if
val
>=
0
:
self
.
funcc
(
n
,
val
)
return
self
.
cost
def
funcc
(
self
,
no
,
nodes
):
if
(
no
==
177
):
self
.
cost
=
self
.
cost
+
route_177
.
get
(
nodes
)
elif
(
no
==
176
):
self
.
cost
=
self
.
cost
+
route_176
.
get
(
nodes
)
elif
(
no
==
8717
):
self
.
cost
=
self
.
cost
+
route_8717
.
get
(
nodes
)
else
:
pass
# Get route
def
main
(
val
,
start
,
destination
):
if
val
==
3
:
map
=
load_map_train
()
elif
val
==
2
:
map
=
load_map_bus
()
else
:
map
=
load_map_test
()
planner
=
PathPlanner
(
map
,
start
,
destination
)
#print(map.roads)
path
=
planner
.
path
if
path
==
False
:
return
False
else
:
return
path
#>>>>>>>>>>>>>>>>>>>>>
def
test1
(
typ
,
start
,
stop1
,
stop2
,
stop3
):
noOfStops
=
3
fullPath
=
[]
totalTrips
=
0
if
(
typ
==
NULL
&
start
==
NULL
&
stop1
==
NULL
&
stop2
==
NULL
):
raise
ValueError
(
'Nodes must not be NULL'
)
if
stop3
==
NULL
:
noOfStops
=
2
if
typ
==
3
:
map
=
load_map_train
()
elif
typ
==
2
:
map
=
load_map_bus
()
else
:
map
=
load_map_test
()
planner1
=
PathPlanner
(
map
,
start
,
stop1
)
path1
=
planner1
.
path
if
path1
==
False
:
raise
ValueError
(
"No path found for planner"
)
if
stop3
==
NULL
:
planner2
=
PathPlanner
(
map
,
stop1
,
stop2
)
path2
=
planner2
.
path
if
path1
==
False
:
raise
ValueError
(
"No path found for planner"
)
path1
.
extend
(
path2
)
else
:
planner2
=
PathPlanner
(
map
,
stop1
,
stop2
)
path2
=
planner2
.
path
if
path1
==
False
:
raise
ValueError
(
"No path found for planner"
)
planner3
=
PathPlanner
(
map
,
stop2
,
stop3
)
path3
=
planner3
.
path
if
path1
==
False
:
raise
ValueError
(
"No path found for planner"
)
path1
.
extend
(
path2
+
path3
)
def
get_nearest_station
(
lon
,
lat
):
map
=
load_map_test
()
tempDist
=
float
(
inf
)
nearestStation
=
None
lon1
=
radians
(
lon
)
lat1
=
radians
(
lat
)
for
node
in
map
.
intersections
.
keys
():
lon2
=
radians
(
map
.
intersections
[
node
][
0
])
lat2
=
radians
(
map
.
intersections
[
node
][
1
])
# Haversine formula
dlon
=
lon2
-
lon1
dlat
=
lat2
-
lat1
a
=
sin
(
dlat
/
2
)
**
2
+
cos
(
lat1
)
*
cos
(
lat2
)
*
sin
(
dlon
/
2
)
**
2
c
=
2
*
asin
(
sqrt
(
a
))
# Radius of earth in kilometers
r
=
6371
# calculate the result
dist
=
(
c
*
r
)
if
dist
<=
tempDist
:
tempDist
=
dist
nearestStation
=
map
.
name
[
node
]
return
nearestStation
#<<<<<<<<<<<<<<<<<
#main( 1, 14, 15)
#>>>>>>>>>>>>>>
#test1(1,2,3,14,18)
#print(get_nearest_station(6.920044890702823, 79.85393963666239))
#>>>>>>>>>>>>>
# from test import test
# test(PathPlanner)
\ No newline at end of file
app/src/main/python/helpers.py
0 → 100644
View file @
ff5a18c3
import
networkx
as
nx
#from chart_studio import plotly as py
import
random
#init_notebook_mode(connected=True)
route_177
=
{
0
:
0
,
1
:
34
,
2
:
42
,
3
:
54
,
4
:
67
,
5
:
80
,
6
:
92
,
7
:
105
,
8
:
109
,
9
:
117
,
10
:
126
,
11
:
134
,
12
:
140
,
13
:
149
,
14
:
157
,
15
:
163
,
}
route_176
=
{
0
:
0
,
1
:
34
,
2
:
42
,
3
:
54
,
}
route_8717
=
{
0
:
0
,
1
:
20
,
2
:
20
,
3
:
20
,
4
:
20
,
5
:
40
}
map_test
=
{
0
:
{
'pos'
:
(
6.911034627182109
,
79.84918916006576
),
'connections'
:
[
1
,
16
],
'name'
:
'Kollupitiya'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
5
},
1
:
{
'pos'
:
(
6.911751932322411
,
79.86194701315071
),
'connections'
:
[
0
,
2
],
'name'
:
'Viharamahadevi Park'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
2
:
{
'pos'
:
(
6.911385550864001
,
79.87682791026592
),
'connections'
:
[
1
,
3
],
'name'
:
'House Of Fashion'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
3
:
{
'pos'
:
(
6.911031363415147
,
79.88498429384545
),
'connections'
:
[
2
,
4
],
'name'
:
'Castle Street'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
4
:
{
'pos'
:
(
6.908462881966912
,
79.89338919261249
),
'connections'
:
[
3
,
5
],
'name'
:
'Rajagiriya'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
5
:
{
'pos'
:
(
6.906663916178293
,
79.90205413217801
),
'connections'
:
[
4
,
6
],
'name'
:
'HSBC Rajagiriya'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
6
:
{
'pos'
:
(
6.90333333857459
,
79.90747047529919
),
'connections'
:
[
5
,
7
],
'name'
:
'Ethulkotte New'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
7
:
{
'pos'
:
(
6.903185701293392
,
79.91168232658337
),
'connections'
:
[
6
,
8
],
'name'
:
'Parliament Junction'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
8
:
{
'pos'
:
(
6.902102452411621
,
79.91741047710077
),
'connections'
:
[
7
,
9
],
'name'
:
'Battaramulla Junction'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
9
:
{
'pos'
:
(
6.90431022366131
,
79.92400480782847
),
'connections'
:
[
8
,
10
],
'name'
:
'Ganahena'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
10
:
{
'pos'
:
(
6.906173952520986
,
79.92862087153598
),
'connections'
:
[
9
,
11
],
'name'
:
'Koswatta'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
11
:
{
'pos'
:
(
6.9084657304543455
,
79.9383708894408
),
'connections'
:
[
10
,
12
],
'name'
:
'Kotte-Bope'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
12
:
{
'pos'
:
(
6.9085023402918155
,
79.94425286198016
),
'connections'
:
[
11
,
13
],
'name'
:
'Thalahena Junction'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
13
:
{
'pos'
:
(
6.903962700873259
,
79.95430199947661
),
'connections'
:
[
12
,
14
],
'name'
:
'Malabe'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
14
:
{
'pos'
:
(
6.933539686667202
,
79.85005389798111
),
'connections'
:
[
15
],
'name'
:
'Fort_TR'
,
'type'
:
1
,
'routeNo'
:
8717
,
'hValue'
:
1
},
15
:
{
'pos'
:
(
6.923619774894732
,
79.84965509086771
),
'connections'
:
[
14
,
16
],
'name'
:
'Kompannavidiya_TR'
,
'type'
:
1
,
'routeNo'
:
8717
,
'hValue'
:
1
},
16
:
{
'pos'
:
(
6.911282166657041
,
79.84821747831087
),
'connections'
:
[
15
,
1
,
17
],
'name'
:
'Kollupitiya_TR'
,
'type'
:
1
,
'routeNo'
:
8717
,
'hValue'
:
1
},
17
:
{
'pos'
:
(
6.893710110662125
,
79.85300590028642
),
'connections'
:
[
16
,
18
],
'name'
:
'Bambalapitiya_TR'
,
'type'
:
1
,
'routeNo'
:
8717
,
'hValue'
:
1
},
18
:
{
'pos'
:
(
6.875030063532378
,
79.85744793142631
),
'connections'
:
[
17
,
19
],
'name'
:
'Wellawatte_TR'
,
'type'
:
1
,
'routeNo'
:
8717
,
'hValue'
:
1
},
19
:
{
'pos'
:
(
6.850915755796403
,
79.8620969312958
),
'connections'
:
[
18
],
'name'
:
'Dehiwala_TR'
,
'type'
:
1
,
'routeNo'
:
8717
,
'hValue'
:
1
},
}
class
Map
:
def
__init__
(
self
,
G
):
self
.
_graph
=
G
self
.
intersections
=
nx
.
get_node_attributes
(
G
,
"pos"
)
self
.
routeNo
=
nx
.
get_node_attributes
(
G
,
"routeNo"
)
self
.
type
=
nx
.
get_node_attributes
(
G
,
"type"
)
self
.
name
=
nx
.
get_node_attributes
(
G
,
"name"
)
self
.
roads
=
[
list
(
G
[
node
])
for
node
in
G
.
nodes
()]
def
load_map_graph
(
map_dict
):
G
=
nx
.
Graph
()
for
node
in
map_dict
.
keys
():
G
.
add_node
(
node
,
pos
=
map_dict
[
node
][
'pos'
],
type
=
map_dict
[
node
][
'type'
],
routeNo
=
map_dict
[
node
][
'routeNo'
],
name
=
map_dict
[
node
][
'name'
])
for
node
in
map_dict
.
keys
():
for
con_node
in
map_dict
[
node
][
'connections'
]:
G
.
add_edge
(
node
,
con_node
)
return
G
def
load_map_b
(
map_dict
):
G
=
nx
.
Graph
()
for
node
in
map_dict
.
keys
():
G
.
add_node
(
node
,
pos
=
map_dict
[
node
][
'pos'
],
type
=
map_dict
[
node
][
'type'
],
routeNo
=
map_dict
[
node
][
'routeNo'
])
for
node
in
map_dict
.
keys
():
for
con_node
in
map_dict
[
node
][
'connections'
]:
if
map_dict
[
node
][
'type'
]
!=
1
:
continue
elif
map_dict
[
con_node
][
'type'
]
!=
1
:
continue
else
:
G
.
add_edge
(
node
,
con_node
)
return
G
#map for train
def
load_map_t
(
map_dict
):
G
=
nx
.
Graph
()
for
node
in
map_dict
.
keys
():
G
.
add_node
(
node
,
pos
=
map_dict
[
node
][
'pos'
],
type
=
map_dict
[
node
][
'type'
],
routeNo
=
map_dict
[
node
][
'routeNo'
])
for
node
in
map_dict
.
keys
():
for
con_node
in
map_dict
[
node
][
'connections'
]:
if
map_dict
[
node
][
'type'
]
==
1
:
continue
elif
map_dict
[
con_node
][
'type'
]
==
1
:
continue
else
:
G
.
add_edge
(
node
,
con_node
)
return
G
def
load_map_test
():
G
=
load_map_graph
(
map_test
)
return
Map
(
G
)
def
load_map_bus
():
G
=
load_map_b
(
map_test
)
return
Map
(
G
)
def
load_map_train
():
G
=
load_map_t
(
map_test
)
return
Map
(
G
)
app/src/main/python/script.py
0 → 100644
View file @
ff5a18c3
def
main
(
paka
,
paka2
):
return
paka
+
12
\ No newline at end of file
app/src/main/res/layout/activity_initial_map.xml
View file @
ff5a18c3
...
@@ -72,6 +72,7 @@
...
@@ -72,6 +72,7 @@
<ImageView
<ImageView
android:id=
"@+id/imageView7"
android:id=
"@+id/imageView7"
android:layout_width=
"539dp"
android:layout_width=
"539dp"
...
@@ -95,6 +96,22 @@
...
@@ -95,6 +96,22 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
<AutoCompleteTextView
android:id=
"@+id/current_location"
android:layout_width=
"340dp"
android:layout_height=
"59dp"
android:layout_marginStart=
"32dp"
android:layout_marginBottom=
"30dp"
android:hint=
"Where to"
android:fontFamily=
"@font/sans_bold"
android:textColorHint=
"@drawable/selector"
android:textAlignment=
"center"
android:completionThreshold=
"1"
android:completionHint=
"Select a city"
android:background=
"@drawable/rounded_corner"
app:layout_constraintBottom_toTopOf=
"@+id/where_to"
app:layout_constraintStart_toStartOf=
"parent"
/>
<AutoCompleteTextView
<AutoCompleteTextView
android:id=
"@+id/where_to"
android:id=
"@+id/where_to"
android:layout_width=
"340dp"
android:layout_width=
"340dp"
...
...
app/src/main/res/layout/activity_retrieve_bus_map.xml
View file @
ff5a18c3
...
@@ -6,4 +6,4 @@
...
@@ -6,4 +6,4 @@
android:name=
"com.google.android.gms.maps.SupportMapFragment"
android:name=
"com.google.android.gms.maps.SupportMapFragment"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".RetrieveBusMap"
/>
tools:context=
".RetrieveBusMap"
/>
\ No newline at end of file
app/src/main/res/layout/route_activity.xml
0 → 100644
View file @
ff5a18c3
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<!-- <fragment-->
<!-- android:id="@+id/mapsFrag"-->
<!-- android:name="com.google.android.gms.maps.MapFragment"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- android:layout_below="@+id/rvToolbar"-->
<!-- android:layout_weight="1" />-->
<!-- <Button-->
<!-- android:id="@+id/btnGetDirection"-->
<!-- android:text="Get Direction"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="?attr/selectableItemBackground" />-->
</LinearLayout>
\ No newline at end of file
app/src/main/res/navigation/nav_graph2.xml
0 → 100644
View file @
ff5a18c3
<?xml version="1.0" encoding="utf-8"?>
<navigation
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/nav_graph2"
app:startDestination=
"@id/First2Fragment"
>
<fragment
android:id=
"@+id/First2Fragment"
android:name=
"com.app.travelle.First2Fragment"
android:label=
"@string/first_fragment_label"
tools:layout=
"@layout/fragment_first2"
>
<action
android:id=
"@+id/action_First2Fragment_to_Second2Fragment"
app:destination=
"@id/Second2Fragment"
/>
</fragment>
<fragment
android:id=
"@+id/Second2Fragment"
android:name=
"com.app.travelle.Second2Fragment"
android:label=
"@string/second_fragment_label"
tools:layout=
"@layout/fragment_second2"
>
<action
android:id=
"@+id/action_Second2Fragment_to_First2Fragment"
app:destination=
"@id/First2Fragment"
/>
</fragment>
</navigation>
\ No newline at end of file
app/src/main/res/values-land/dimens.xml
View file @
ff5a18c3
<resources>
<resources>
<dimen
name=
"fab_margin"
>
48dp
</dimen>
<dimen
name=
"fab_margin"
>
48dp
</dimen>
</resources>
</resources>
\ No newline at end of file
\ No newline at end of file
app/src/main/res/values-w1240dp/dimens.xml
View file @
ff5a18c3
<resources>
<resources>
<dimen
name=
"fab_margin"
>
200dp
</dimen>
<dimen
name=
"fab_margin"
>
200dp
</dimen>
</resources>
</resources>
\ No newline at end of file
\ No newline at end of file
app/src/main/res/values-w600dp/dimens.xml
View file @
ff5a18c3
<resources>
<resources>
<dimen
name=
"fab_margin"
>
48dp
</dimen>
<dimen
name=
"fab_margin"
>
48dp
</dimen>
</resources>
</resources>
\ No newline at end of file
\ No newline at end of file
app/src/main/res/values/dimens.xml
View file @
ff5a18c3
<resources>
<resources>
<dimen
name=
"fab_margin"
>
16dp
</dimen>
<dimen
name=
"fab_margin"
>
16dp
</dimen>
<dimen
name=
"activity_horizontal_margin"
>
0dp
</dimen>
<dimen
name=
"activity_horizontal_margin"
>
0dp
</dimen>
<dimen
name=
"activity_vertical_margin"
>
0dp
</dimen>
<dimen
name=
"activity_vertical_margin"
>
0dp
</dimen>
</resources>
</resources>
\ No newline at end of file
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
ff5a18c3
...
@@ -12,4 +12,6 @@
...
@@ -12,4 +12,6 @@
<string
name=
"title_activity_homemap"
>
homemap
</string>
<string
name=
"title_activity_homemap"
>
homemap
</string>
<string
name=
"title_activity_home_map"
>
HomeMap
</string>
<string
name=
"title_activity_home_map"
>
HomeMap
</string>
<string
name=
"title_activity_retrieve_bus_map"
>
RetrieveBusMap
</string>
<string
name=
"title_activity_retrieve_bus_map"
>
RetrieveBusMap
</string>
<string
name=
"title_activity_route"
>
RouteActivity
</string>
<string
name=
"google_maps_key"
>
AIzaSyA6byk50XLU3_WXUpsy7HGfpKbbrjwVlj8
</string>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/themes.xml
View file @
ff5a18c3
...
@@ -13,10 +13,13 @@
...
@@ -13,10 +13,13 @@
<item
name=
"android:statusBarColor"
>
?attr/colorPrimaryVariant
</item>
<item
name=
"android:statusBarColor"
>
?attr/colorPrimaryVariant
</item>
<!-- Customize your theme here. -->
<!-- Customize your theme here. -->
</style>
</style>
<style
name=
"Theme.Travelle.NoActionBar"
>
<style
name=
"Theme.Travelle.NoActionBar"
>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowNoTitle"
>
true
</item>
<item
name=
"windowNoTitle"
>
true
</item>
</style>
</style>
<style
name=
"Theme.Travelle.AppBarOverlay"
parent=
"ThemeOverlay.AppCompat.Dark.ActionBar"
/>
<style
name=
"Theme.Travelle.AppBarOverlay"
parent=
"ThemeOverlay.AppCompat.Dark.ActionBar"
/>
<style
name=
"Theme.Travelle.PopupOverlay"
parent=
"ThemeOverlay.AppCompat.Light"
/>
<style
name=
"Theme.Travelle.PopupOverlay"
parent=
"ThemeOverlay.AppCompat.Light"
/>
</resources>
</resources>
\ No newline at end of file
build.gradle
View file @
ff5a18c3
buildscript
{
buildscript
{
repositories
{
repositories
{
// Make sure that you have the following two repositories
// Make sure that you have the following two repositories
maven
{
url
"https://chaquo.com/maven"
}
}
}
dependencies
{
dependencies
{
classpath
'com.google.gms:google-services:4.3.14'
classpath
'com.google.gms:google-services:4.3.14'
classpath
"com.chaquo.python:gradle:13.0.0"
classpath
"com.chaquo.python:gradle:13.0.0"
}
}
...
@@ -16,6 +17,7 @@ plugins {
...
@@ -16,6 +17,7 @@ plugins {
id
'com.android.application'
version
'7.3.0'
apply
false
id
'com.android.application'
version
'7.3.0'
apply
false
id
'com.android.library'
version
'7.3.0'
apply
false
id
'com.android.library'
version
'7.3.0'
apply
false
id
'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
version
'2.0.1'
apply
false
id
'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
version
'2.0.1'
apply
false
id
'com.chaquo.python'
version
'13.0.0'
apply
false
}
}
allprojects
{
allprojects
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment