Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
5
5711403296
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paded
5711403296
Commits
b32a2165
Commit
b32a2165
authored
Jan 22, 2018
by
Paded
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tracker bus success
parent
d839d2e4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
482 additions
and
5 deletions
+482
-5
build_file_checksums.ser
.idea/caches/build_file_checksums.ser
+0
-0
build.gradle
app/build.gradle
+1
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+6
-0
CreateAccountActivity.java
...er/paded/com/ubontransitdriver/CreateAccountActivity.java
+1
-2
MainActivity.java
...ansitdriver/paded/com/ubontransitdriver/MainActivity.java
+196
-0
ResetPasswordActivity.java
...er/paded/com/ubontransitdriver/ResetPasswordActivity.java
+0
-1
TrackerService.java
...sitdriver/paded/com/ubontransitdriver/TrackerService.java
+111
-0
bg_active.xml
app/src/main/res/drawable/bg_active.xml
+12
-0
bg_btn_activebus.xml
app/src/main/res/drawable/bg_btn_activebus.xml
+9
-0
bg_btn_activebus_clicked.xml
app/src/main/res/drawable/bg_btn_activebus_clicked.xml
+12
-0
bg_btn_activebus_normal.xml
app/src/main/res/drawable/bg_btn_activebus_normal.xml
+12
-0
bg_busstatus_off.xml
app/src/main/res/drawable/bg_busstatus_off.xml
+12
-0
bg_busstatus_on.xml
app/src/main/res/drawable/bg_busstatus_on.xml
+12
-0
ic_wifi_bus.xml
app/src/main/res/drawable/ic_wifi_bus.xml
+6
-0
bottom_sheet_endtrip.xml
app/src/main/res/layout/bottom_sheet_endtrip.xml
+60
-0
main_layout.xml
app/src/main/res/layout/main_layout.xml
+0
-0
reset_password_layout.xml
app/src/main/res/layout/reset_password_layout.xml
+24
-2
strings.xml
app/src/main/res/values/strings.xml
+8
-0
No files found.
.idea/caches/build_file_checksums.ser
View file @
b32a2165
No preview for this file type
app/build.gradle
View file @
b32a2165
...
@@ -26,6 +26,7 @@ dependencies {
...
@@ -26,6 +26,7 @@ dependencies {
implementation
'com.android.support.constraint:constraint-layout:1.0.2'
implementation
'com.android.support.constraint:constraint-layout:1.0.2'
implementation
'com.google.firebase:firebase-auth:11.6.0'
implementation
'com.google.firebase:firebase-auth:11.6.0'
implementation
'com.google.firebase:firebase-database:11.6.0'
implementation
'com.google.firebase:firebase-database:11.6.0'
implementation
'com.google.android.gms:play-services-location:11.6.0'
testImplementation
'junit:junit:4.12'
testImplementation
'junit:junit:4.12'
androidTestImplementation
'com.android.support.test:runner:1.0.1'
androidTestImplementation
'com.android.support.test:runner:1.0.1'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.1'
...
...
app/src/main/AndroidManifest.xml
View file @
b32a2165
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
package=
"ubontransitdriver.paded.com.ubontransitdriver"
>
package=
"ubontransitdriver.paded.com.ubontransitdriver"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<application
<application
android:allowBackup=
"true"
android:allowBackup=
"true"
...
@@ -32,6 +33,10 @@
...
@@ -32,6 +33,10 @@
<activity
android:name=
".ResetPasswordActivity"
/>
<activity
android:name=
".ResetPasswordActivity"
/>
<activity
android:name=
".AddBusActivity"
/>
<activity
android:name=
".AddBusActivity"
/>
<activity
android:name=
".ProfileSettingActivity"
></activity>
<activity
android:name=
".ProfileSettingActivity"
></activity>
<service
android:name=
".TrackerService"
android:enabled=
"true"
android:exported=
"true"
></service>
</application>
</application>
</manifest>
</manifest>
\ No newline at end of file
app/src/main/java/ubontransitdriver/paded/com/ubontransitdriver/CreateAccountActivity.java
View file @
b32a2165
...
@@ -295,9 +295,9 @@ public class CreateAccountActivity extends AppCompatActivity implements ItemAdap
...
@@ -295,9 +295,9 @@ public class CreateAccountActivity extends AppCompatActivity implements ItemAdap
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
DatabaseReference
myRef
=
database
.
getReference
(
"users/"
+
uid
);
DatabaseReference
myRef
=
database
.
getReference
(
"users/"
+
uid
);
myRef
.
child
(
"name"
).
setValue
(
name
);
myRef
.
child
(
"name"
).
setValue
(
name
);
myRef
.
child
(
"bus_id"
).
setValue
(
busid
);
myRef
.
child
(
"bus_id"
).
setValue
(
busid
);
myRef
.
child
(
"status"
).
setValue
(
"on"
);
}
}
@Override
@Override
...
@@ -325,7 +325,6 @@ public class CreateAccountActivity extends AppCompatActivity implements ItemAdap
...
@@ -325,7 +325,6 @@ public class CreateAccountActivity extends AppCompatActivity implements ItemAdap
Snackbar
.
make
(
coordinatorLayout
,
item
+
" is selected"
,
Snackbar
.
LENGTH_LONG
)
Snackbar
.
make
(
coordinatorLayout
,
item
+
" is selected"
,
Snackbar
.
LENGTH_LONG
)
.
setAction
(
"Action"
,
null
).
show
();
.
setAction
(
"Action"
,
null
).
show
();
behavior
.
setState
(
BottomSheetBehavior
.
STATE_COLLAPSED
);
behavior
.
setState
(
BottomSheetBehavior
.
STATE_COLLAPSED
);
inputAddBus
.
setText
(
item
);
inputAddBus
.
setText
(
item
);
Log
.
d
(
TAG
,
"onItemClick: "
);
Log
.
d
(
TAG
,
"onItemClick: "
);
...
...
app/src/main/java/ubontransitdriver/paded/com/ubontransitdriver/MainActivity.java
View file @
b32a2165
package
ubontransitdriver
.
paded
.
com
.
ubontransitdriver
;
package
ubontransitdriver
.
paded
.
com
.
ubontransitdriver
;
import
android.Manifest
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.location.LocationManager
;
import
android.support.design.widget.BottomSheetBehavior
;
import
android.support.design.widget.BottomSheetDialog
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.content.ContextCompat
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.FrameLayout
;
import
android.widget.ImageButton
;
import
android.widget.ImageButton
;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.google.firebase.auth.FirebaseAuth
;
import
com.google.firebase.auth.FirebaseAuth
;
import
com.google.firebase.auth.FirebaseUser
;
import
com.google.firebase.auth.FirebaseUser
;
...
@@ -21,22 +32,73 @@ public class MainActivity extends AppCompatActivity {
...
@@ -21,22 +32,73 @@ public class MainActivity extends AppCompatActivity {
private
FirebaseAuth
auth
;
private
FirebaseAuth
auth
;
private
ImageButton
btn_profile
;
private
ImageButton
btn_profile
;
private
String
TAG
=
"mainAC"
;
private
String
TAG
=
"mainAC"
;
private
ProgressBar
progressBar
;
private
Button
btn_endtrip
,
btn_endtrip_cancel
,
btn_active_bus
,
btn_return
,
btn_endtrip_yes
;
// private Boolean user_status = true;
private
TextView
txt_user_status_on
,
txt_user_status_off
;
BottomSheetDialog
bottomSheetDialog
;
BottomSheetBehavior
bottomSheetBehavior
;
private
FrameLayout
view_cover
;
private
boolean
active_status
=
true
;
private
static
final
int
PERMISSIONS_REQUEST
=
1
;
String
bus_id
;
String
user_status
;
String
user_id
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
main_layout
);
setContentView
(
R
.
layout
.
main_layout
);
auth
=
FirebaseAuth
.
getInstance
();
auth
=
FirebaseAuth
.
getInstance
();
FirebaseUser
user
=
auth
.
getCurrentUser
();
FirebaseUser
user
=
auth
.
getCurrentUser
();
progressBar
=
(
ProgressBar
)
findViewById
(
R
.
id
.
progressBar
);
btn_profile
=
(
ImageButton
)
findViewById
(
R
.
id
.
btn_profile
);
btn_profile
=
(
ImageButton
)
findViewById
(
R
.
id
.
btn_profile
);
btn_endtrip
=
(
Button
)
findViewById
(
R
.
id
.
btn_endtrip
);
txt_user_status_on
=
(
TextView
)
findViewById
(
R
.
id
.
txt_user_status_on
);
txt_user_status_off
=
(
TextView
)
findViewById
(
R
.
id
.
txt_user_status_off
);
btn_active_bus
=
(
Button
)
findViewById
(
R
.
id
.
btn_active_bus
);
btn_return
=
(
Button
)
findViewById
(
R
.
id
.
btn_return
);
// view_cover = (FrameLayout) findViewById(R.id.view_cover);
progressBar
.
setVisibility
(
View
.
VISIBLE
);
// view_cover.getForeground().setAlpha(100);
View
bottomSheetView
=
getLayoutInflater
().
inflate
(
R
.
layout
.
bottom_sheet_endtrip
,
null
);
bottomSheetDialog
=
new
BottomSheetDialog
(
MainActivity
.
this
);
bottomSheetDialog
.
setContentView
(
bottomSheetView
);
bottomSheetBehavior
=
BottomSheetBehavior
.
from
((
View
)
bottomSheetView
.
getParent
());
btn_endtrip_cancel
=
(
Button
)
bottomSheetView
.
findViewById
(
R
.
id
.
btn_endtrip_cancel
);
btn_endtrip_yes
=
(
Button
)
bottomSheetView
.
findViewById
(
R
.
id
.
btn_endtrip_yes
);
DatabaseReference
database
=
FirebaseDatabase
.
getInstance
().
getReference
();
DatabaseReference
database
=
FirebaseDatabase
.
getInstance
().
getReference
();
// Attach a listener to read the data at our posts reference
// Attach a listener to read the data at our posts reference
database
.
child
(
"users/"
+
user
.
getUid
()).
addValueEventListener
(
new
ValueEventListener
()
{
database
.
child
(
"users/"
+
user
.
getUid
()).
addValueEventListener
(
new
ValueEventListener
()
{
@Override
@Override
public
void
onDataChange
(
DataSnapshot
dataSnapshot
)
{
public
void
onDataChange
(
DataSnapshot
dataSnapshot
)
{
FirebaseUser
user
=
auth
.
getCurrentUser
();
Log
.
d
(
TAG
,
"onDataChange: "
+
dataSnapshot
.
child
(
"name"
).
getValue
(
String
.
class
));
Log
.
d
(
TAG
,
"onDataChange: "
+
dataSnapshot
.
child
(
"name"
).
getValue
(
String
.
class
));
Log
.
d
(
TAG
,
"onDataChange: "
+
dataSnapshot
.
child
(
"bus_id"
).
getValue
(
String
.
class
));
Log
.
d
(
TAG
,
"onDataChange: "
+
dataSnapshot
.
child
(
"bus_id"
).
getValue
(
String
.
class
));
Log
.
d
(
TAG
,
"onDataChange: "
+
dataSnapshot
.
child
(
"status"
).
getValue
(
String
.
class
));
user_status
=
dataSnapshot
.
child
(
"status"
).
getValue
(
String
.
class
);
bus_id
=
dataSnapshot
.
child
(
"bus_id"
).
getValue
(
String
.
class
);
user_id
=
user
.
getUid
();
updateUI
(
user_status
);
if
(
user_status
.
equalsIgnoreCase
(
"on"
)){
trackBus
(
user_id
,
bus_id
);
}
}
}
@Override
@Override
...
@@ -46,6 +108,10 @@ public class MainActivity extends AppCompatActivity {
...
@@ -46,6 +108,10 @@ public class MainActivity extends AppCompatActivity {
});
});
// if(!user_status){
// txt_user_status.setVisibility(View.GONE);
// }
btn_profile
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
btn_profile
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
...
@@ -55,6 +121,55 @@ public class MainActivity extends AppCompatActivity {
...
@@ -55,6 +121,55 @@ public class MainActivity extends AppCompatActivity {
}
}
});
});
btn_endtrip
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
bottomSheetDialog
.
show
();
}
});
btn_endtrip_yes
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
progressBar
.
setVisibility
(
View
.
VISIBLE
);
FirebaseUser
user
=
auth
.
getCurrentUser
();
active_status
=
false
;
if
(
bus_id
!=
null
){
Intent
intent
=
new
Intent
(
MainActivity
.
this
,
TrackerService
.
class
);
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
DatabaseReference
myRef
=
database
.
getReference
(
"active_bus/"
+
bus_id
);
myRef
.
child
(
user
.
getUid
()).
removeValue
();
stopService
(
intent
);
}
// DatabaseReference myRef = database.getReference("active_bus/"+bus_id+"/"+user_id);
// myRef.child("lat").setValue(12);
// myRef.child("lng").setValue(12);
UpdateUserStatus
(
user
.
getUid
(),
active_status
);
bottomSheetDialog
.
hide
();
}
});
btn_endtrip_cancel
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
bottomSheetDialog
.
hide
();
}
});
btn_active_bus
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
progressBar
.
setVisibility
(
View
.
VISIBLE
);
FirebaseUser
user
=
auth
.
getCurrentUser
();
active_status
=
true
;
UpdateUserStatus
(
user
.
getUid
(),
active_status
);
}
});
...
@@ -70,4 +185,85 @@ public class MainActivity extends AppCompatActivity {
...
@@ -70,4 +185,85 @@ public class MainActivity extends AppCompatActivity {
}
}
public
void
UpdateUserStatus
(
String
user_id
,
boolean
active_status
){
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
DatabaseReference
myRef
=
database
.
getReference
(
"users/"
+
user_id
);
if
(!
active_status
){
myRef
.
child
(
"status"
).
setValue
(
"off"
);
}
else
{
myRef
.
child
(
"status"
).
setValue
(
"on"
);
}
progressBar
.
setVisibility
(
View
.
GONE
);
}
public
void
updateUI
(
String
user_status
){
if
(
user_status
.
equalsIgnoreCase
(
"off"
)){
btn_active_bus
.
setVisibility
(
View
.
VISIBLE
);
txt_user_status_off
.
setVisibility
(
View
.
VISIBLE
);
btn_endtrip
.
setVisibility
(
View
.
GONE
);
btn_return
.
setVisibility
(
View
.
GONE
);
txt_user_status_on
.
setVisibility
(
View
.
GONE
);
}
else
{
btn_active_bus
.
setVisibility
(
View
.
GONE
);
txt_user_status_off
.
setVisibility
(
View
.
GONE
);
btn_endtrip
.
setVisibility
(
View
.
VISIBLE
);
btn_return
.
setVisibility
(
View
.
VISIBLE
);
txt_user_status_on
.
setVisibility
(
View
.
VISIBLE
);
}
progressBar
.
setVisibility
(
View
.
GONE
);
// view_cover.getForeground().setAlpha(0);
Log
.
d
(
TAG
,
"updateUI: "
+
user_status
);
}
public
void
trackBus
(
String
user_id
,
String
bus_id
){
// Check GPS is enabled ****
LocationManager
lm
=
(
LocationManager
)
getSystemService
(
LOCATION_SERVICE
);
if
(!
lm
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
))
{
Toast
.
makeText
(
this
,
"Please enable location services"
,
Toast
.
LENGTH_SHORT
).
show
();
finish
();
}
// Check location permission is granted - if it is, start
// the service, otherwise request the permission
int
permission
=
ContextCompat
.
checkSelfPermission
(
this
,
android
.
Manifest
.
permission
.
ACCESS_FINE_LOCATION
);
if
(
permission
==
PackageManager
.
PERMISSION_GRANTED
)
{
startTrackerService
(
user_id
,
bus_id
);
}
else
{
ActivityCompat
.
requestPermissions
(
this
,
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
PERMISSIONS_REQUEST
);
}
// FirebaseDatabase database = FirebaseDatabase.getInstance();
// DatabaseReference myRef = database.getReference("active_bus/"+bus_id+"/"+user_id);
// myRef.child("lat").setValue(12);
// myRef.child("lng").setValue(12);
}
private
void
startTrackerService
(
String
user_id
,
String
bus_id
)
{
Intent
intent
=
new
Intent
(
this
,
TrackerService
.
class
);
intent
.
putExtra
(
"user_id"
,
user_id
);
intent
.
putExtra
(
"bus_id"
,
bus_id
);
startService
(
intent
);
}
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
String
[]
permissions
,
int
[]
grantResults
)
{
if
(
requestCode
==
PERMISSIONS_REQUEST
&&
grantResults
.
length
==
1
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
// Start the service when the permission is granted
startTrackerService
(
user_id
,
bus_id
);
}
else
{
finish
();
}
}
}
}
app/src/main/java/ubontransitdriver/paded/com/ubontransitdriver/ResetPasswordActivity.java
View file @
b32a2165
...
@@ -74,7 +74,6 @@ public class ResetPasswordActivity extends AppCompatActivity {
...
@@ -74,7 +74,6 @@ public class ResetPasswordActivity extends AppCompatActivity {
}
else
{
}
else
{
Toast
.
makeText
(
ResetPasswordActivity
.
this
,
R
.
string
.
send_password_reset_failed_msg
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
ResetPasswordActivity
.
this
,
R
.
string
.
send_password_reset_failed_msg
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
progressBar
.
setVisibility
(
View
.
GONE
);
progressBar
.
setVisibility
(
View
.
GONE
);
}
}
});
});
...
...
app/src/main/java/ubontransitdriver/paded/com/ubontransitdriver/TrackerService.java
0 → 100644
View file @
b32a2165
package
ubontransitdriver
.
paded
.
com
.
ubontransitdriver
;
import
android.Manifest
;
import
android.app.PendingIntent
;
import
android.app.Service
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.pm.PackageManager
;
import
android.location.Location
;
import
android.os.IBinder
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.NotificationCompat
;
import
android.support.v4.content.ContextCompat
;
import
android.util.Log
;
import
android.widget.Toast
;
import
com.google.android.gms.location.FusedLocationProviderClient
;
import
com.google.android.gms.location.LocationCallback
;
import
com.google.android.gms.location.LocationRequest
;
import
com.google.android.gms.location.LocationResult
;
import
com.google.android.gms.location.LocationServices
;
import
com.google.firebase.database.DatabaseReference
;
import
com.google.firebase.database.FirebaseDatabase
;
public
class
TrackerService
extends
Service
{
private
static
final
String
TAG
=
"GPS2"
;
@Override
public
void
onCreate
()
{
super
.
onCreate
();
}
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
String
user_id
=
intent
.
getStringExtra
(
"user_id"
);
String
bus_id
=
intent
.
getStringExtra
(
"bus_id"
);
buildNotification
();
requestLocationUpdates
(
user_id
,
bus_id
);
Toast
.
makeText
(
this
,
"MyService Started."
,
Toast
.
LENGTH_SHORT
).
show
();
//If service is killed while starting, it restarts.
return
START_STICKY
;
}
public
TrackerService
()
{
}
@Nullable
@Override
public
IBinder
onBind
(
Intent
intent
)
{
return
null
;
}
private
void
buildNotification
()
{
String
stop
=
"stop"
;
registerReceiver
(
stopReceiver
,
new
IntentFilter
(
stop
));
PendingIntent
broadcastIntent
=
PendingIntent
.
getBroadcast
(
this
,
0
,
new
Intent
(
stop
),
PendingIntent
.
FLAG_UPDATE_CURRENT
);
// Create the persistent notification
NotificationCompat
.
Builder
builder
=
new
NotificationCompat
.
Builder
(
this
)
.
setContentTitle
(
getString
(
R
.
string
.
app_name
))
.
setContentText
(
getString
(
R
.
string
.
notification_text
))
.
setOngoing
(
true
)
.
setContentIntent
(
broadcastIntent
)
.
setSmallIcon
(
R
.
drawable
.
ic_bus
);
startForeground
(
1
,
builder
.
build
());
}
protected
BroadcastReceiver
stopReceiver
=
new
BroadcastReceiver
()
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
Log
.
d
(
TAG
,
"received stop broadcast"
);
// Stop the service when the notification is tapped
unregisterReceiver
(
stopReceiver
);
stopSelf
();
}
};
private
void
requestLocationUpdates
(
String
user_id
,
String
bus_id
)
{
LocationRequest
request
=
new
LocationRequest
();
request
.
setInterval
(
10000
);
request
.
setFastestInterval
(
5000
);
request
.
setPriority
(
LocationRequest
.
PRIORITY_HIGH_ACCURACY
);
FusedLocationProviderClient
client
=
LocationServices
.
getFusedLocationProviderClient
(
this
);
final
String
path
=
"active_bus/"
+
bus_id
+
"/"
+
user_id
;
Log
.
d
(
TAG
,
"requestLocationUpdates: "
+
path
);
int
permission
=
ContextCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
);
if
(
permission
==
PackageManager
.
PERMISSION_GRANTED
)
{
// Request location updates and when an update is
// received, store the location in Firebase
client
.
requestLocationUpdates
(
request
,
new
LocationCallback
()
{
@Override
public
void
onLocationResult
(
LocationResult
locationResult
)
{
DatabaseReference
ref
=
FirebaseDatabase
.
getInstance
().
getReference
(
path
);
Location
location
=
locationResult
.
getLastLocation
();
if
(
location
!=
null
)
{
Log
.
d
(
TAG
,
"location update "
+
location
);
ref
.
child
(
"latitude"
).
setValue
(
location
.
getLatitude
());
ref
.
child
(
"longitude"
).
setValue
(
location
.
getLongitude
());
ref
.
child
(
"time"
).
setValue
(
location
.
getTime
());
}
}
},
null
);
}
}
}
app/src/main/res/drawable/bg_active.xml
0 → 100644
View file @
b32a2165
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/green"
/>
<corners
android:radius=
"360dp"
/>
<padding
android:bottom=
"7dip"
android:left=
"7dip"
android:right=
"7dip"
android:top=
"7dip"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_btn_activebus.xml
0 → 100644
View file @
b32a2165
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_focused=
"true"
android:state_pressed=
"true"
android:drawable=
"@drawable/bg_btn_activebus_clicked"
/>
<item
android:state_focused=
"false"
android:state_pressed=
"true"
android:drawable=
"@drawable/bg_btn_activebus_clicked"
/>
<item
android:drawable=
"@drawable/bg_btn_activebus_normal"
/>
</selector>
\ No newline at end of file
app/src/main/res/drawable/bg_btn_activebus_clicked.xml
0 → 100644
View file @
b32a2165
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/off_green"
/>
<corners
android:radius=
"8dp"
/>
<padding
android:bottom=
"7dip"
android:left=
"7dip"
android:right=
"7dip"
android:top=
"7dip"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_btn_activebus_normal.xml
0 → 100644
View file @
b32a2165
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/green"
/>
<corners
android:radius=
"8dp"
/>
<padding
android:bottom=
"7dip"
android:left=
"7dip"
android:right=
"7dip"
android:top=
"7dip"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_busstatus_off.xml
0 → 100644
View file @
b32a2165
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/gray_100"
/>
<corners
android:radius=
"360dp"
/>
<padding
android:bottom=
"7dip"
android:left=
"7dip"
android:right=
"7dip"
android:top=
"7dip"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_busstatus_on.xml
0 → 100644
View file @
b32a2165
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/green"
/>
<corners
android:radius=
"360dp"
/>
<padding
android:bottom=
"7dip"
android:left=
"7dip"
android:right=
"7dip"
android:top=
"7dip"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/ic_wifi_bus.xml
0 → 100644
View file @
b32a2165
<vector
android:height=
"24dp"
android:viewportHeight=
"45.996"
android:viewportWidth=
"45.996"
android:width=
"24dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<path
android:fillColor=
"@color/white"
android:pathData=
"M33.793,5.688C33.424,5.5 32.99,5.49 32.612,5.661c-0.376,0.172 -0.655,0.506 -0.755,0.908l-0.041,0.166c-0.15,0.609 0.135,1.241 0.691,1.53c2.054,1.064 3.318,3.252 3.195,5.574c-0.033,0.648 0.396,1.231 1.026,1.388l0.167,0.042c0.393,0.097 0.807,0.015 1.132,-0.226c0.325,-0.24 0.526,-0.611 0.55,-1.015C38.777,10.548 36.877,7.267 33.793,5.688z"
/>
<path
android:fillColor=
"@color/white"
android:pathData=
"M35.043,0.093c-0.362,-0.142 -0.771,-0.121 -1.116,0.059c-0.347,0.18 -0.601,0.499 -0.695,0.877L33.19,1.194c-0.165,0.661 0.187,1.338 0.82,1.587c4.931,1.939 7.942,7.041 7.218,12.312c-0.094,0.686 0.343,1.334 1.016,1.5l0.166,0.042c0.373,0.092 0.769,0.022 1.086,-0.194c0.319,-0.215 0.53,-0.556 0.584,-0.938C44.998,8.904 41.225,2.511 35.043,0.093z"
/>
<path
android:fillColor=
"@color/white"
android:pathData=
"M23.926,7.513H11.369c-5.317,0 -9.589,4.285 -9.589,9.603l0,0v19.658c0,1.901 1.139,3.522 2.848,4.144v1.514c-0.001,1.972 1.6,3.564 3.572,3.564h0.562c1.972,0 3.595,-1.593 3.595,-3.565v-1.234h10.577v1.235c0,1.973 1.589,3.564 3.561,3.564h0.562c1.972,0 3.605,-1.593 3.605,-3.564v-1.516c1.627,-0.621 2.849,-2.241 2.849,-4.143V17.076l0,0C33.51,11.78 29.222,7.513 23.926,7.513zM8.721,37.176c-1.771,0 -3.208,-1.437 -3.208,-3.21c0,-1.772 1.437,-3.209 3.208,-3.209c1.773,0 3.21,1.438 3.21,3.209C11.931,35.738 10.494,37.176 8.721,37.176zM7.718,25.819c-1.174,0 -2.114,-0.989 -2.114,-2.164V18.36c0,-3.346 2.701,-6.047 6.046,-6.047h11.955c3.347,0 6.081,2.701 6.081,6.047v5.295c0,1.174 -0.975,2.164 -2.148,2.164H7.718zM26.535,37.176c-1.773,0 -3.21,-1.437 -3.21,-3.21c0,-1.772 1.437,-3.209 3.21,-3.209c1.771,0 3.209,1.438 3.209,3.209C29.744,35.738 28.307,37.176 26.535,37.176z"
/>
</vector>
app/src/main/res/layout/bottom_sheet_endtrip.xml
0 → 100644
View file @
b32a2165
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/fragment_history_menu_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"#ffffff"
android:orientation=
"vertical"
android:paddingTop=
"20dp"
android:paddingBottom=
"16dp"
android:paddingLeft=
"18dp"
android:paddingRight=
"18dp"
app:layout_behavior=
"android.support.design.widget.BottomSheetBehavior"
>
<TextView
android:textStyle=
"bold"
android:textSize=
"32dp"
android:textColor=
"@color/gray_900"
android:text=
"Do you want to End Trip?"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<TextView
android:layout_marginTop=
"10dp"
android:textSize=
"18dp"
android:textColor=
"@color/gray_900"
android:text=
"Make your bus invisible to everyone?"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<Button
android:id=
"@+id/btn_endtrip_yes"
android:layout_marginTop=
"18dp"
style=
"?android:attr/borderlessButtonStyle"
android:background=
"@drawable/bg_return_bus"
android:textStyle=
"bold"
android:text=
"End Trip"
android:textSize=
"18dp"
android:textColor=
"@color/white"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<Button
android:id=
"@+id/btn_endtrip_cancel"
style=
"?android:attr/borderlessButtonStyle"
android:layout_marginTop=
"8dp"
android:textStyle=
"bold"
android:text=
"Cancel"
android:textSize=
"18dp"
android:textColor=
"@color/gray_500"
android:background=
"@drawable/bg_endtrip_bus"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/main_layout.xml
View file @
b32a2165
This diff is collapsed.
Click to expand it.
app/src/main/res/layout/reset_password_layout.xml
View file @
b32a2165
...
@@ -64,15 +64,37 @@
...
@@ -64,15 +64,37 @@
android:padding=
"10dp"
android:padding=
"10dp"
android:text=
"@string/btn_resetPassword"
android:text=
"@string/btn_resetPassword"
android:textColor=
"#ffffffff"
/>
android:textColor=
"#ffffffff"
/>
<!--<LinearLayout -->
<!--android:layout_marginTop="20dp"-->
<!--android:orientation="horizontal"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content">-->
<!--<ImageButton-->
<!--android:id="@+id/btn_back"-->
<!--style="?android:attr/borderlessButtonStyle"-->
<!--android:layout_width="48dp"-->
<!--android:layout_height="48dp"-->
<!--android:background="@drawable/bg_profile"-->
<!--android:src="@drawable/ic_previous" />-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content" -->
<!--android:textColor="@color/gray_600"-->
<!--android:textStyle="bold"-->
<!--android:textSize="18dp"-->
<!--android:text="Back"/>-->
<!--</LinearLayout>-->
<Button
<Button
android:id=
"@+id/btn_back"
android:id=
"@+id/btn_back"
android:drawableLeft=
"@drawable/ic_
arrow_back_24dp
"
android:drawableLeft=
"@drawable/ic_
previous
"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:layout_marginTop=
"20dp"
android:text=
"Back"
android:text=
"Back"
android:textColor=
"@color/
red
"
android:textColor=
"@color/
gray_600
"
style=
"?android:attr/borderlessButtonStyle"
style=
"?android:attr/borderlessButtonStyle"
/>
/>
...
...
app/src/main/res/values/strings.xml
View file @
b32a2165
...
@@ -33,4 +33,12 @@
...
@@ -33,4 +33,12 @@
<string
name=
"action_settings"
>
Settings
</string>
<string
name=
"action_settings"
>
Settings
</string>
<!--Notifacation-->
<string
name=
"notification_text"
>
Tracking, tap to cancel
</string>
<string
name=
"transport_id"
translatable=
"false"
>
Got-Device
</string>
<string
name=
"firebase_path"
translatable=
"false"
>
locations
</string>
<string
name=
"firebase_email"
translatable=
"false"
>
test@example.com
</string>
<string
name=
"firebase_password"
translatable=
"false"
>
password
</string>
</resources>
</resources>
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