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
7959a8fa
Commit
7959a8fa
authored
Jan 23, 2018
by
Paded
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add notification
parent
b32a2165
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
764 additions
and
238 deletions
+764
-238
build_file_checksums.ser
.idea/caches/build_file_checksums.ser
+0
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+2
-1
MainActivity.java
...ansitdriver/paded/com/ubontransitdriver/MainActivity.java
+90
-44
TrackerService.java
...sitdriver/paded/com/ubontransitdriver/TrackerService.java
+47
-4
TrackerService2.java
...itdriver/paded/com/ubontransitdriver/TrackerService2.java
+128
-0
TrackerService3.java
...itdriver/paded/com/ubontransitdriver/TrackerService3.java
+120
-0
bg_btn_activebus_clicked.xml
app/src/main/res/drawable/bg_btn_activebus_clicked.xml
+1
-1
bg_btn_activebus_normal.xml
app/src/main/res/drawable/bg_btn_activebus_normal.xml
+6
-1
bus_color_icon_red.xml
app/src/main/res/drawable/bus_color_icon_red.xml
+2
-1
ic_sort.xml
app/src/main/res/drawable/ic_sort.xml
+4
-0
ic_track_changes_green_24dp.xml
app/src/main/res/drawable/ic_track_changes_green_24dp.xml
+9
-0
ic_track_changes_white_24dp.xml
app/src/main/res/drawable/ic_track_changes_white_24dp.xml
+9
-0
icon_active_clicked.xml
app/src/main/res/drawable/icon_active_clicked.xml
+9
-0
text_active_color.xml
app/src/main/res/drawable/text_active_color.xml
+6
-0
main_layout.xml
app/src/main/res/layout/main_layout.xml
+330
-186
colors.xml
app/src/main/res/values/colors.xml
+1
-0
No files found.
.idea/caches/build_file_checksums.ser
View file @
7959a8fa
No preview for this file type
app/src/main/AndroidManifest.xml
View file @
7959a8fa
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
android:supportsRtl=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
android:theme=
"@style/AppTheme"
>
<activity
<activity
android:launchMode=
"singleTop"
android:name=
".MainActivity"
android:name=
".MainActivity"
android:windowSoftInputMode=
"adjustResize"
/>
android:windowSoftInputMode=
"adjustResize"
/>
<activity
<activity
...
@@ -34,7 +35,7 @@
...
@@ -34,7 +35,7 @@
<activity
android:name=
".AddBusActivity"
/>
<activity
android:name=
".AddBusActivity"
/>
<activity
android:name=
".ProfileSettingActivity"
></activity>
<activity
android:name=
".ProfileSettingActivity"
></activity>
<service
<service
android:name=
".TrackerService"
android:name=
".TrackerService
3
"
android:enabled=
"true"
android:enabled=
"true"
android:exported=
"true"
></service>
android:exported=
"true"
></service>
</application>
</application>
...
...
app/src/main/java/ubontransitdriver/paded/com/ubontransitdriver/MainActivity.java
View file @
7959a8fa
package
ubontransitdriver
.
paded
.
com
.
ubontransitdriver
;
package
ubontransitdriver
.
paded
.
com
.
ubontransitdriver
;
import
android.Manifest
;
import
android.Manifest
;
import
android.app.NotificationManager
;
import
android.app.PendingIntent
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.location.LocationManager
;
import
android.location.LocationManager
;
import
android.net.Uri
;
import
android.support.design.widget.BottomSheetBehavior
;
import
android.support.design.widget.BottomSheetBehavior
;
import
android.support.design.widget.BottomSheetDialog
;
import
android.support.design.widget.BottomSheetDialog
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.NotificationCompat
;
import
android.support.v4.content.ContextCompat
;
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
;
...
@@ -33,8 +39,8 @@ public class MainActivity extends AppCompatActivity {
...
@@ -33,8 +39,8 @@ public class MainActivity extends AppCompatActivity {
private
ImageButton
btn_profile
;
private
ImageButton
btn_profile
;
private
String
TAG
=
"mainAC"
;
private
String
TAG
=
"mainAC"
;
private
ProgressBar
progressBar
;
private
ProgressBar
progressBar
;
private
Button
btn_endtrip
,
btn_endtrip_cancel
,
btn_active_bus
,
btn_return
,
btn_endtrip_yes
;
private
Button
btn_endtrip
,
btn_endtrip_cancel
,
btn_active_bus
,
btn_return
,
btn_endtrip_yes
;
// private Boolean user_status = true;
// private Boolean user_status = true;
private
TextView
txt_user_status_on
,
txt_user_status_off
;
private
TextView
txt_user_status_on
,
txt_user_status_off
;
BottomSheetDialog
bottomSheetDialog
;
BottomSheetDialog
bottomSheetDialog
;
BottomSheetBehavior
bottomSheetBehavior
;
BottomSheetBehavior
bottomSheetBehavior
;
...
@@ -46,6 +52,8 @@ public class MainActivity extends AppCompatActivity {
...
@@ -46,6 +52,8 @@ public class MainActivity extends AppCompatActivity {
String
user_status
;
String
user_status
;
String
user_id
;
String
user_id
;
NotificationManager
mNotificationManager
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
...
@@ -56,14 +64,13 @@ public class MainActivity extends AppCompatActivity {
...
@@ -56,14 +64,13 @@ public class MainActivity extends AppCompatActivity {
FirebaseUser
user
=
auth
.
getCurrentUser
();
FirebaseUser
user
=
auth
.
getCurrentUser
();
progressBar
=
(
ProgressBar
)
findViewById
(
R
.
id
.
progressBar
);
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
);
btn_endtrip
=
(
Button
)
findViewById
(
R
.
id
.
btn_endtrip
);
txt_user_status_on
=
(
TextView
)
findViewById
(
R
.
id
.
txt_user_status_on
);
txt_user_status_on
=
(
TextView
)
findViewById
(
R
.
id
.
txt_user_status_on
);
txt_user_status_off
=
(
TextView
)
findViewById
(
R
.
id
.
txt_user_status_off
);
txt_user_status_off
=
(
TextView
)
findViewById
(
R
.
id
.
txt_user_status_off
);
btn_active_bus
=
(
Button
)
findViewById
(
R
.
id
.
btn_active_bus
);
btn_active_bus
=
(
Button
)
findViewById
(
R
.
id
.
btn_active_bus
);
btn_return
=
(
Button
)
findViewById
(
R
.
id
.
btn_return
);
btn_return
=
(
Button
)
findViewById
(
R
.
id
.
btn_return
);
// view_cover = (FrameLayout) findViewById(R.id.view_cover);
// view_cover = (FrameLayout) findViewById(R.id.view_cover);
...
@@ -77,25 +84,26 @@ public class MainActivity extends AppCompatActivity {
...
@@ -77,25 +84,26 @@ public class MainActivity extends AppCompatActivity {
bottomSheetDialog
.
setContentView
(
bottomSheetView
);
bottomSheetDialog
.
setContentView
(
bottomSheetView
);
bottomSheetBehavior
=
BottomSheetBehavior
.
from
((
View
)
bottomSheetView
.
getParent
());
bottomSheetBehavior
=
BottomSheetBehavior
.
from
((
View
)
bottomSheetView
.
getParent
());
btn_endtrip_cancel
=
(
Button
)
bottomSheetView
.
findViewById
(
R
.
id
.
btn_endtrip_cancel
);
btn_endtrip_cancel
=
(
Button
)
bottomSheetView
.
findViewById
(
R
.
id
.
btn_endtrip_cancel
);
btn_endtrip_yes
=
(
Button
)
bottomSheetView
.
findViewById
(
R
.
id
.
btn_endtrip_yes
);
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
();
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
));
Log
.
d
(
TAG
,
"onDataChange: "
+
dataSnapshot
.
child
(
"status"
).
getValue
(
String
.
class
));
user_status
=
dataSnapshot
.
child
(
"status"
).
getValue
(
String
.
class
);
user_status
=
dataSnapshot
.
child
(
"status"
).
getValue
(
String
.
class
);
bus_id
=
dataSnapshot
.
child
(
"bus_id"
).
getValue
(
String
.
class
);
bus_id
=
dataSnapshot
.
child
(
"bus_id"
).
getValue
(
String
.
class
);
user_id
=
user
.
getUid
();
user_id
=
user
.
getUid
();
updateUI
(
user_status
);
updateUI
(
user_status
);
if
(
user_status
.
equalsIgnoreCase
(
"on"
)){
if
(
user_status
.
equalsIgnoreCase
(
"on"
))
{
trackBus
(
user_id
,
bus_id
);
buildNotification
();
trackBus
(
user_id
,
bus_id
);
}
}
...
@@ -135,18 +143,19 @@ public class MainActivity extends AppCompatActivity {
...
@@ -135,18 +143,19 @@ public class MainActivity extends AppCompatActivity {
FirebaseUser
user
=
auth
.
getCurrentUser
();
FirebaseUser
user
=
auth
.
getCurrentUser
();
active_status
=
false
;
active_status
=
false
;
if
(
bus_id
!=
null
)
{
if
(
bus_id
!=
null
)
{
Intent
intent
=
new
Intent
(
MainActivity
.
this
,
TrackerService
.
class
);
Intent
intent
=
new
Intent
(
MainActivity
.
this
,
TrackerService
3
.
class
);
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
DatabaseReference
myRef
=
database
.
getReference
(
"active_bus/"
+
bus_id
);
DatabaseReference
myRef
=
database
.
getReference
(
"active_bus/"
+
bus_id
);
myRef
.
child
(
user
.
getUid
()).
removeValue
();
myRef
.
child
(
user
.
getUid
()).
removeValue
();
stopService
(
intent
);
stopService
(
intent
);
mNotificationManager
.
cancel
(
001
);
}
}
// DatabaseReference myRef = database.getReference("active_bus/"+bus_id+"/"+user_id);
// DatabaseReference myRef = database.getReference("active_bus/"+bus_id+"/"+user_id);
// myRef.child("lat").setValue(12);
// myRef.child("lat").setValue(12);
// myRef.child("lng").setValue(12);
// myRef.child("lng").setValue(12);
UpdateUserStatus
(
user
.
getUid
(),
active_status
);
UpdateUserStatus
(
user
.
getUid
(),
active_status
);
bottomSheetDialog
.
hide
();
bottomSheetDialog
.
hide
();
}
}
});
});
...
@@ -164,16 +173,11 @@ public class MainActivity extends AppCompatActivity {
...
@@ -164,16 +173,11 @@ public class MainActivity extends AppCompatActivity {
progressBar
.
setVisibility
(
View
.
VISIBLE
);
progressBar
.
setVisibility
(
View
.
VISIBLE
);
FirebaseUser
user
=
auth
.
getCurrentUser
();
FirebaseUser
user
=
auth
.
getCurrentUser
();
active_status
=
true
;
active_status
=
true
;
UpdateUserStatus
(
user
.
getUid
(),
active_status
);
UpdateUserStatus
(
user
.
getUid
(),
active_status
);
}
}
});
});
//
//
// MaterialShadowContainerView shadowView =
// MaterialShadowContainerView shadowView =
// (MaterialShadowContainerView) findViewById(R.id.shadow_item_container);
// (MaterialShadowContainerView) findViewById(R.id.shadow_item_container);
...
@@ -186,27 +190,27 @@ public class MainActivity extends AppCompatActivity {
...
@@ -186,27 +190,27 @@ public class MainActivity extends AppCompatActivity {
}
}
public
void
UpdateUserStatus
(
String
user_id
,
boolean
active_status
){
public
void
UpdateUserStatus
(
String
user_id
,
boolean
active_status
)
{
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
DatabaseReference
myRef
=
database
.
getReference
(
"users/"
+
user_id
);
DatabaseReference
myRef
=
database
.
getReference
(
"users/"
+
user_id
);
if
(!
active_status
)
{
if
(!
active_status
)
{
myRef
.
child
(
"status"
).
setValue
(
"off"
);
myRef
.
child
(
"status"
).
setValue
(
"off"
);
}
else
{
}
else
{
myRef
.
child
(
"status"
).
setValue
(
"on"
);
myRef
.
child
(
"status"
).
setValue
(
"on"
);
}
}
progressBar
.
setVisibility
(
View
.
GONE
);
progressBar
.
setVisibility
(
View
.
GONE
);
}
}
public
void
updateUI
(
String
user_status
){
public
void
updateUI
(
String
user_status
)
{
if
(
user_status
.
equalsIgnoreCase
(
"off"
))
{
if
(
user_status
.
equalsIgnoreCase
(
"off"
))
{
btn_active_bus
.
setVisibility
(
View
.
VISIBLE
);
btn_active_bus
.
setVisibility
(
View
.
VISIBLE
);
txt_user_status_off
.
setVisibility
(
View
.
VISIBLE
);
txt_user_status_off
.
setVisibility
(
View
.
VISIBLE
);
btn_endtrip
.
setVisibility
(
View
.
GONE
);
btn_endtrip
.
setVisibility
(
View
.
GONE
);
btn_return
.
setVisibility
(
View
.
GONE
);
btn_return
.
setVisibility
(
View
.
GONE
);
txt_user_status_on
.
setVisibility
(
View
.
GONE
);
txt_user_status_on
.
setVisibility
(
View
.
GONE
);
}
else
{
}
else
{
btn_active_bus
.
setVisibility
(
View
.
GONE
);
btn_active_bus
.
setVisibility
(
View
.
GONE
);
txt_user_status_off
.
setVisibility
(
View
.
GONE
);
txt_user_status_off
.
setVisibility
(
View
.
GONE
);
...
@@ -216,22 +220,22 @@ public class MainActivity extends AppCompatActivity {
...
@@ -216,22 +220,22 @@ public class MainActivity extends AppCompatActivity {
}
}
progressBar
.
setVisibility
(
View
.
GONE
);
progressBar
.
setVisibility
(
View
.
GONE
);
// view_cover.getForeground().setAlpha(0);
// view_cover.getForeground().setAlpha(0);
Log
.
d
(
TAG
,
"updateUI: "
+
user_status
);
Log
.
d
(
TAG
,
"updateUI: "
+
user_status
);
}
}
public
void
trackBus
(
String
user_id
,
String
bus_id
)
{
public
void
trackBus
(
String
user_id
,
String
bus_id
)
{
// Check GPS is enabled ****
// Check GPS is enabled ****
LocationManager
lm
=
(
LocationManager
)
getSystemService
(
LOCATION_SERVICE
);
LocationManager
lm
=
(
LocationManager
)
getSystemService
(
LOCATION_SERVICE
);
if
(!
lm
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
))
{
if
(!
lm
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
))
{
Toast
.
makeText
(
this
,
"Please enable location services"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
this
,
"Please enable location services"
,
Toast
.
LENGTH_SHORT
).
show
();
finish
();
}
}
// Check location permission is granted - if it is, start
// Check location permission is granted - if it is, start
// the service, otherwise request the permission
// the service, otherwise request the permission
int
permission
=
ContextCompat
.
checkSelfPermission
(
this
,
int
permission
=
ContextCompat
.
checkSelfPermission
(
this
,
android
.
Manifest
.
permission
.
ACCESS_FINE_LOCATION
);
android
.
Manifest
.
permission
.
ACCESS_FINE_LOCATION
);
if
(
permission
==
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
permission
==
PackageManager
.
PERMISSION_GRANTED
)
{
startTrackerService
(
user_id
,
bus_id
);
startTrackerService
(
user_id
,
bus_id
);
Log
.
d
(
TAG
,
"trackBus: "
);
}
else
{
}
else
{
ActivityCompat
.
requestPermissions
(
this
,
ActivityCompat
.
requestPermissions
(
this
,
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
...
@@ -244,13 +248,12 @@ public class MainActivity extends AppCompatActivity {
...
@@ -244,13 +248,12 @@ public class MainActivity extends AppCompatActivity {
// myRef.child("lng").setValue(12);
// myRef.child("lng").setValue(12);
}
}
private
void
startTrackerService
(
String
user_id
,
String
bus_id
)
{
private
void
startTrackerService
(
String
user_id
,
String
bus_id
)
{
Intent
intent
=
new
Intent
(
this
,
TrackerService
.
class
);
Intent
intent
=
new
Intent
(
this
,
TrackerService3
.
class
);
intent
.
putExtra
(
"user_id"
,
user_id
);
intent
.
putExtra
(
"user_id"
,
user_id
);
intent
.
putExtra
(
"bus_id"
,
bus_id
);
intent
.
putExtra
(
"bus_id"
,
bus_id
);
startService
(
intent
);
startService
(
intent
);
}
}
...
@@ -260,10 +263,53 @@ public class MainActivity extends AppCompatActivity {
...
@@ -260,10 +263,53 @@ public class MainActivity extends AppCompatActivity {
if
(
requestCode
==
PERMISSIONS_REQUEST
&&
grantResults
.
length
==
1
if
(
requestCode
==
PERMISSIONS_REQUEST
&&
grantResults
.
length
==
1
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
// Start the service when the permission is granted
// Start the service when the permission is granted
startTrackerService
(
user_id
,
bus_id
);
startTrackerService
(
user_id
,
bus_id
);
Log
.
d
(
TAG
,
"onRequestPermissionsResult: Start"
);
}
else
{
}
else
{
finish
();
finish
();
}
}
}
}
private
void
buildNotification
()
{
NotificationCompat
.
Builder
mBuilder
=
new
NotificationCompat
.
Builder
(
this
)
.
setSmallIcon
(
R
.
drawable
.
ic_wifi_bus
)
.
setContentTitle
(
"On Going"
)
.
setContentText
(
"Tracking, tap to open"
)
.
setOngoing
(
true
);
//Create the intent that’ll fire when the user taps the notification//
// Intent intent = new Intent(this, MainActivity.class);
// PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
//
// mBuilder.setContentIntent(pendingIntent);
PendingIntent
contentIntent
=
PendingIntent
.
getActivity
(
this
,
0
,
new
Intent
(
this
,
MainActivity
.
class
),
PendingIntent
.
FLAG_UPDATE_CURRENT
);
mBuilder
.
setContentIntent
(
contentIntent
);
mNotificationManager
=
(
NotificationManager
)
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
mNotificationManager
.
notify
(
001
,
mBuilder
.
build
());
}
@Override
protected
void
onPause
()
{
super
.
onPause
();
// if(user_status.equalsIgnoreCase("on")){
// buildNotification();
// }
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
// NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
// notificationManager.cancel(001);
}
}
}
app/src/main/java/ubontransitdriver/paded/com/ubontransitdriver/TrackerService.java
View file @
7959a8fa
...
@@ -9,13 +9,17 @@ import android.content.Intent;
...
@@ -9,13 +9,17 @@ import android.content.Intent;
import
android.content.IntentFilter
;
import
android.content.IntentFilter
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.location.Location
;
import
android.location.Location
;
import
android.os.Handler
;
import
android.os.HandlerThread
;
import
android.os.IBinder
;
import
android.os.IBinder
;
import
android.os.Looper
;
import
android.os.Message
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.NotificationCompat
;
import
android.support.v4.app.NotificationCompat
;
import
android.support.v4.content.ContextCompat
;
import
android.support.v4.content.ContextCompat
;
import
android.util.Log
;
import
android.util.Log
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
android.os.Process
;
import
com.google.android.gms.location.FusedLocationProviderClient
;
import
com.google.android.gms.location.FusedLocationProviderClient
;
import
com.google.android.gms.location.LocationCallback
;
import
com.google.android.gms.location.LocationCallback
;
import
com.google.android.gms.location.LocationRequest
;
import
com.google.android.gms.location.LocationRequest
;
...
@@ -26,10 +30,18 @@ import com.google.firebase.database.FirebaseDatabase;
...
@@ -26,10 +30,18 @@ import com.google.firebase.database.FirebaseDatabase;
public
class
TrackerService
extends
Service
{
public
class
TrackerService
extends
Service
{
private
static
final
String
TAG
=
"GPS2"
;
private
static
final
String
TAG
=
"GPS2"
;
private
boolean
isRunning
=
false
;
private
Looper
looper
;
private
MyServiceHandler
myServiceHandler
;
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
super
.
onCreate
();
HandlerThread
handlerthread
=
new
HandlerThread
(
"MyThread"
,
Process
.
THREAD_PRIORITY_BACKGROUND
);
handlerthread
.
start
();
looper
=
handlerthread
.
getLooper
();
myServiceHandler
=
new
MyServiceHandler
(
looper
);
isRunning
=
true
;
}
}
...
@@ -37,7 +49,7 @@ public class TrackerService extends Service {
...
@@ -37,7 +49,7 @@ public class TrackerService extends Service {
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
String
user_id
=
intent
.
getStringExtra
(
"user_id"
);
String
user_id
=
intent
.
getStringExtra
(
"user_id"
);
String
bus_id
=
intent
.
getStringExtra
(
"bus_id"
);
String
bus_id
=
intent
.
getStringExtra
(
"bus_id"
);
buildNotification
();
//
buildNotification();
requestLocationUpdates
(
user_id
,
bus_id
);
requestLocationUpdates
(
user_id
,
bus_id
);
Toast
.
makeText
(
this
,
"MyService Started."
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
this
,
"MyService Started."
,
Toast
.
LENGTH_SHORT
).
show
();
//If service is killed while starting, it restarts.
//If service is killed while starting, it restarts.
...
@@ -53,6 +65,37 @@ public class TrackerService extends Service {
...
@@ -53,6 +65,37 @@ public class TrackerService extends Service {
return
null
;
return
null
;
}
}
@Override
public
void
onDestroy
()
{
isRunning
=
false
;
Toast
.
makeText
(
this
,
"MyService Completed or Stopped."
,
Toast
.
LENGTH_SHORT
).
show
();
}
private
final
class
MyServiceHandler
extends
Handler
{
public
MyServiceHandler
(
Looper
looper
)
{
super
(
looper
);
}
@Override
public
void
handleMessage
(
Message
msg
)
{
synchronized
(
this
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
try
{
Log
.
i
(
TAG
,
"MyService running..."
);
Thread
.
sleep
(
1000
);
}
catch
(
Exception
e
)
{
Log
.
i
(
TAG
,
e
.
getMessage
());
}
if
(!
isRunning
){
break
;
}
}
}
//stops the service for the start id.
stopSelfResult
(
msg
.
arg1
);
}
}
private
void
buildNotification
()
{
private
void
buildNotification
()
{
String
stop
=
"stop"
;
String
stop
=
"stop"
;
registerReceiver
(
stopReceiver
,
new
IntentFilter
(
stop
));
registerReceiver
(
stopReceiver
,
new
IntentFilter
(
stop
));
...
@@ -64,7 +107,7 @@ public class TrackerService extends Service {
...
@@ -64,7 +107,7 @@ public class TrackerService extends Service {
.
setContentText
(
getString
(
R
.
string
.
notification_text
))
.
setContentText
(
getString
(
R
.
string
.
notification_text
))
.
setOngoing
(
true
)
.
setOngoing
(
true
)
.
setContentIntent
(
broadcastIntent
)
.
setContentIntent
(
broadcastIntent
)
.
setSmallIcon
(
R
.
drawable
.
ic_
bus
);
.
setSmallIcon
(
R
.
drawable
.
ic_
frontal_bus_silhouette
);
startForeground
(
1
,
builder
.
build
());
startForeground
(
1
,
builder
.
build
());
}
}
...
...
app/src/main/java/ubontransitdriver/paded/com/ubontransitdriver/TrackerService2.java
0 → 100644
View file @
7959a8fa
package
ubontransitdriver
.
paded
.
com
.
ubontransitdriver
;
import
android.app.Service
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.location.Location
;
import
android.location.LocationManager
;
import
android.os.Bundle
;
import
android.os.IBinder
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.ActivityCompat
;
import
android.util.Log
;
public
class
TrackerService2
extends
Service
{
private
static
final
String
TAG
=
"MyLocationService"
;
private
LocationManager
mLocationManager
=
null
;
private
static
final
int
LOCATION_INTERVAL
=
50000
;
private
static
final
float
LOCATION_DISTANCE
=
10
;
private
class
LocationListener
implements
android
.
location
.
LocationListener
{
Location
mLastLocation
;
public
LocationListener
(
String
provider
)
{
Log
.
e
(
TAG
,
"LocationListener "
+
provider
);
mLastLocation
=
new
Location
(
provider
);
}
@Override
public
void
onLocationChanged
(
Location
location
)
{
Log
.
e
(
TAG
,
"onLocationChanged: "
+
location
);
mLastLocation
.
set
(
location
);
Log
.
d
(
TAG
,
"onLocationChanged Lat Lng: "
+
location
.
getLatitude
()+
" "
+
location
.
getLongitude
());
}
@Override
public
void
onProviderDisabled
(
String
provider
)
{
Log
.
e
(
TAG
,
"onProviderDisabled: "
+
provider
);
}
@Override
public
void
onProviderEnabled
(
String
provider
)
{
Log
.
e
(
TAG
,
"onProviderEnabled: "
+
provider
);
}
@Override
public
void
onStatusChanged
(
String
provider
,
int
status
,
Bundle
extras
)
{
Log
.
e
(
TAG
,
"onStatusChanged: "
+
provider
);
}
}
LocationListener
[]
mLocationListeners
=
new
LocationListener
[]{
new
LocationListener
(
LocationManager
.
PASSIVE_PROVIDER
)
};
@Override
public
IBinder
onBind
(
Intent
arg0
)
{
return
null
;
}
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
Log
.
e
(
TAG
,
"onStartCommand"
);
super
.
onStartCommand
(
intent
,
flags
,
startId
);
return
START_STICKY
;
}
@Override
public
void
onCreate
()
{
Log
.
e
(
TAG
,
"onCreate"
);
initializeLocationManager
();
try
{
mLocationManager
.
requestLocationUpdates
(
LocationManager
.
PASSIVE_PROVIDER
,
LOCATION_INTERVAL
,
LOCATION_DISTANCE
,
mLocationListeners
[
0
]
);
}
catch
(
java
.
lang
.
SecurityException
ex
)
{
Log
.
i
(
TAG
,
"fail to request location update, ignore"
,
ex
);
}
catch
(
IllegalArgumentException
ex
)
{
Log
.
d
(
TAG
,
"network provider does not exist, "
+
ex
.
getMessage
());
}
/*try {
mLocationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
LOCATION_INTERVAL,
LOCATION_DISTANCE,
mLocationListeners[1]
);
} catch (java.lang.SecurityException ex) {
Log.i(TAG, "fail to request location update, ignore", ex);
} catch (IllegalArgumentException ex) {
Log.d(TAG, "gps provider does not exist " + ex.getMessage());
}*/
}
@Override
public
void
onDestroy
()
{
Log
.
e
(
TAG
,
"onDestroy"
);
super
.
onDestroy
();
if
(
mLocationManager
!=
null
)
{
for
(
int
i
=
0
;
i
<
mLocationListeners
.
length
;
i
++)
{
try
{
if
(
ActivityCompat
.
checkSelfPermission
(
this
,
android
.
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
ActivityCompat
.
checkSelfPermission
(
this
,
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
return
;
}
mLocationManager
.
removeUpdates
(
mLocationListeners
[
i
]);
}
catch
(
Exception
ex
)
{
Log
.
i
(
TAG
,
"fail to remove location listener, ignore"
,
ex
);
}
}
}
}
private
void
initializeLocationManager
()
{
Log
.
e
(
TAG
,
"initializeLocationManager - LOCATION_INTERVAL: "
+
LOCATION_INTERVAL
+
" LOCATION_DISTANCE: "
+
LOCATION_DISTANCE
);
if
(
mLocationManager
==
null
)
{
mLocationManager
=
(
LocationManager
)
getApplicationContext
().
getSystemService
(
Context
.
LOCATION_SERVICE
);
}
}
}
app/src/main/java/ubontransitdriver/paded/com/ubontransitdriver/TrackerService3.java
0 → 100644
View file @
7959a8fa
package
ubontransitdriver
.
paded
.
com
.
ubontransitdriver
;
import
android.app.Service
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.location.Location
;
import
android.os.Bundle
;
import
android.os.IBinder
;
import
android.os.Looper
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.support.v4.content.ContextCompat
;
import
android.util.Log
;
import
android.Manifest
;
import
com.google.android.gms.common.ConnectionResult
;
import
com.google.android.gms.common.api.GoogleApiClient
;
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
;
import
java.util.Calendar
;
import
java.util.Date
;
public
class
TrackerService3
extends
Service
implements
GoogleApiClient
.
ConnectionCallbacks
,
GoogleApiClient
.
OnConnectionFailedListener
{
FusedLocationProviderClient
mFusedLocationClient
;
GoogleApiClient
mGoogleApiClient
;
LocationRequest
mLocationRequest
;
String
TAG
=
"trackService"
;
private
String
user_id
;
private
String
bus_id
;
@Nullable
@Override
public
IBinder
onBind
(
Intent
intent
)
{
return
null
;
}
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
user_id
=
intent
.
getStringExtra
(
"user_id"
);
bus_id
=
intent
.
getStringExtra
(
"bus_id"
);
Log
.
d
(
TAG
,
"onStartCommand: "
+
user_id
+
" "
+
bus_id
);
mFusedLocationClient
=
LocationServices
.
getFusedLocationProviderClient
(
this
);
if
(
mGoogleApiClient
!=
null
&&
mFusedLocationClient
!=
null
)
{
requestLocationUpdates
();
}
else
{
buildGoogleApiClient
();
}
return
START_STICKY
;
}
protected
synchronized
void
buildGoogleApiClient
()
{
mGoogleApiClient
=
new
GoogleApiClient
.
Builder
(
this
)
.
addConnectionCallbacks
(
this
)
.
addOnConnectionFailedListener
(
this
)
.
addApi
(
LocationServices
.
API
)
.
build
();
mGoogleApiClient
.
connect
();
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
if
(
mFusedLocationClient
!=
null
)
{
Log
.
d
(
TAG
,
"Service Stop"
);
mFusedLocationClient
.
removeLocationUpdates
(
mLocationCallback
);
}
}
public
void
requestLocationUpdates
()
{
mLocationRequest
=
new
LocationRequest
();
mLocationRequest
.
setInterval
(
10000
);
// two minute interval
mLocationRequest
.
setFastestInterval
(
5000
);
mLocationRequest
.
setPriority
(
LocationRequest
.
PRIORITY_HIGH_ACCURACY
);
if
(
ContextCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
mFusedLocationClient
.
requestLocationUpdates
(
mLocationRequest
,
mLocationCallback
,
Looper
.
myLooper
());
}
}
LocationCallback
mLocationCallback
=
new
LocationCallback
(){
@Override
public
void
onLocationResult
(
LocationResult
locationResult
)
{
final
String
path
=
"active_bus/"
+
bus_id
+
"/"
+
user_id
;
for
(
Location
location
:
locationResult
.
getLocations
())
{
DatabaseReference
ref
=
FirebaseDatabase
.
getInstance
().
getReference
(
path
);
ref
.
child
(
"latitude"
).
setValue
(
location
.
getLatitude
());
ref
.
child
(
"longitude"
).
setValue
(
location
.
getLongitude
());
ref
.
child
(
"time"
).
setValue
(
location
.
getTime
());
// Date currentTime = Calendar.getInstance().getTime();
// Log.d(TAG, "Location: " + location.getLatitude() + " " + location.getLongitude()+" "+location.getTime()+" "+currentTime);
}
};
};
@Override
public
void
onConnected
(
@Nullable
Bundle
bundle
)
{
requestLocationUpdates
();
}
@Override
public
void
onConnectionSuspended
(
int
i
)
{
}
@Override
public
void
onConnectionFailed
(
@NonNull
ConnectionResult
connectionResult
)
{
}
}
app/src/main/res/drawable/bg_btn_activebus_clicked.xml
View file @
7959a8fa
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/
off_
green"
/>
<solid
android:color=
"@color/green"
/>
<corners
android:radius=
"8dp"
/>
<corners
android:radius=
"8dp"
/>
<padding
<padding
...
...
app/src/main/res/drawable/bg_btn_activebus_normal.xml
View file @
7959a8fa
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/
green
"
/>
<solid
android:color=
"@color/
white
"
/>
<corners
android:radius=
"8dp"
/>
<corners
android:radius=
"8dp"
/>
<stroke
android:width =
"1.5dp"
android:color=
"@color/green"
/>
<padding
<padding
android:bottom=
"7dip"
android:bottom=
"7dip"
android:left=
"7dip"
android:left=
"7dip"
...
...
app/src/main/res/drawable/bus_color_icon_red.xml
View file @
7959a8fa
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
</padding>
</padding>
<corners
<corners
android:radius=
"
8
dp"
>
android:radius=
"
360
dp"
>
</corners>
</corners>
</shape>
</shape>
\ No newline at end of file
app/src/main/res/drawable/ic_sort.xml
0 → 100644
View file @
7959a8fa
<vector
android:height=
"24dp"
android:viewportHeight=
"426.667"
android:viewportWidth=
"426.667"
android:width=
"24dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<path
android:fillColor=
"@color/gray_400"
android:pathData=
"M213.333,0C95.467,0 0,95.467 0,213.333s95.467,213.333 213.333,213.333S426.667,331.2 426.667,213.333S331.2,0 213.333,0zM96,149.333l74.667,-74.667l74.667,74.667H192v85.333h-42.667v-85.333H96zM256,352l-74.667,-74.667h53.333V192h42.667v85.333h53.333L256,352z"
/>
</vector>
app/src/main/res/drawable/ic_track_changes_green_24dp.xml
0 → 100644
View file @
7959a8fa
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"@color/green"
android:pathData=
"M19.07,4.93l-1.41,1.41C19.1,7.79 20,9.79 20,12c0,4.42 -3.58,8 -8,8s-8,-3.58 -8,-8c0,-4.08 3.05,-7.44 7,-7.93v2.02C8.16,6.57 6,9.03 6,12c0,3.31 2.69,6 6,6s6,-2.69 6,-6c0,-1.66 -0.67,-3.16 -1.76,-4.24l-1.41,1.41C15.55,9.9 16,10.9 16,12c0,2.21 -1.79,4 -4,4s-4,-1.79 -4,-4c0,-1.86 1.28,-3.41 3,-3.86v2.14c-0.6,0.35 -1,0.98 -1,1.72 0,1.1 0.9,2 2,2s2,-0.9 2,-2c0,-0.74 -0.4,-1.38 -1,-1.72V2h-1C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10c0,-2.76 -1.12,-5.26 -2.93,-7.07z"
/>
</vector>
app/src/main/res/drawable/ic_track_changes_white_24dp.xml
0 → 100644
View file @
7959a8fa
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"@color/white"
android:pathData=
"M19.07,4.93l-1.41,1.41C19.1,7.79 20,9.79 20,12c0,4.42 -3.58,8 -8,8s-8,-3.58 -8,-8c0,-4.08 3.05,-7.44 7,-7.93v2.02C8.16,6.57 6,9.03 6,12c0,3.31 2.69,6 6,6s6,-2.69 6,-6c0,-1.66 -0.67,-3.16 -1.76,-4.24l-1.41,1.41C15.55,9.9 16,10.9 16,12c0,2.21 -1.79,4 -4,4s-4,-1.79 -4,-4c0,-1.86 1.28,-3.41 3,-3.86v2.14c-0.6,0.35 -1,0.98 -1,1.72 0,1.1 0.9,2 2,2s2,-0.9 2,-2c0,-0.74 -0.4,-1.38 -1,-1.72V2h-1C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10c0,-2.76 -1.12,-5.26 -2.93,-7.07z"
/>
</vector>
app/src/main/res/drawable/icon_active_clicked.xml
0 → 100644
View file @
7959a8fa
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
android:drawable=
"@drawable/ic_track_changes_white_24dp"
/>
<!-- pressed -->
<item
android:state_focused=
"true"
android:drawable=
"@drawable/ic_track_changes_white_24dp"
/>
<!-- focused -->
<item
android:drawable=
"@drawable/ic_track_changes_green_24dp"
/>
<!-- default -->
</selector>
\ No newline at end of file
app/src/main/res/drawable/text_active_color.xml
0 → 100644
View file @
7959a8fa
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
android:color=
"@color/white"
/>
<item
android:color=
"@color/green"
/>
</selector>
\ No newline at end of file
app/src/main/res/layout/main_layout.xml
View file @
7959a8fa
...
@@ -45,22 +45,23 @@
...
@@ -45,22 +45,23 @@
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"10dp"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<
Linear
Layout
<
Relative
Layout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Your route"
android:layout_gravity=
"center_vertical"
android:textColor=
"@color/gray_900"
android:text=
"Route"
android:textSize=
"32dp"
android:textColor=
"@color/gray_800"
android:textSize=
"30dp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
</
Linear
Layout>
</
Relative
Layout>
<RelativeLayout
<RelativeLayout
...
@@ -91,231 +92,374 @@
...
@@ -91,231 +92,374 @@
android:background=
"@drawable/bg_busstatus_off"
android:background=
"@drawable/bg_busstatus_off"
android:padding=
"8dp"
android:padding=
"8dp"
android:text=
"On Pause"
android:text=
"On Pause"
android:textColor=
"@color/gray_
5
00"
android:textColor=
"@color/gray_
4
00"
android:textStyle=
"bold"
android:textStyle=
"bold"
android:visibility=
"invisible"
/>
android:visibility=
"invisible"
/>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="1dp"-->
<!--android:layout_marginTop="4dp"-->
<!--android:layout_marginBottom="6dp"-->
<!--android:background="@color/gray_100" />-->
<!--<TextView-->
<!--android:text="Your route"-->
<!--android:textColor="@color/gray_800"-->
<!--android:textStyle="bold"-->
<!--android:textSize="16dp"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content" />-->
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"6dp"
android:background=
"@drawable/bg_destination_driver"
android:background=
"@drawable/bg_destination_driver"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:padding=
"0dp"
>
android:padding=
"0dp"
>
<!--<LinearLayout-->
<!--android:background="@drawable/bg_ongoing"-->
<!--android:padding="8dp"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content">-->
<!--<TextView-->
<!--android:text="On Going"-->
<!--android:textSize="18dp"-->
<!--android:textStyle="bold"-->
<!--android:textColor="@color/white"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content" />-->
<!--</LinearLayout>-->
<LinearLayout
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
android:padding=
"15dp"
>
android:orientation=
"vertical"
android:padding=
"18dp"
>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
android:orientation=
"vertical"
>
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_gravity="center_vertical"-->
<!--android:layout_marginRight="25dp">-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="On Going"-->
<!--android:textColor="@color/green"-->
<!--android:textSize="30dp"-->
<!--android:textStyle="bold" />-->
<!--</LinearLayout>-->
<LinearLayout
<LinearLayout
android:layout_width=
"
match_par
ent"
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
android:orientation=
"horizontal"
>
<LinearLayout
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:layout_marginRight=
"10dp"
<ImageView
android:text=
"To"
android:id=
"@+id/ic_start_circle"
android:textColor=
"@color/gray_800"
android:layout_width=
"wrap_content"
android:textSize=
"26dp"
android:layout_height=
"wrap_content"
android:textStyle=
"bold"
/>
android:layout_gravity=
"center_vertical"
android:layout_toStartOf=
"@+id/text_start"
android:src=
"@drawable/ic_start_black_24dp"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"15dp"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Start Location"
android:textColor=
"@color/gray_900"
android:textStyle=
"bold"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Ubon Ratchathani"
android:textColor=
"@color/gray_600"
android:textSize=
"20dp"
android:textStyle=
"bold"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/ic_line"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_toStartOf=
"@+id/text_start"
android:src=
"@drawable/ic_more_vert_black_24dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/ic_stop_circle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_toStartOf=
"@+id/text_start"
android:src=
"@drawable/ic_stop_black_24dp"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"15dp"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Your Destination"
android:textColor=
"@color/gray_900"
android:textStyle=
"bold"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Terminal Ubon"
android:textColor=
"@color/gray_600"
android:textSize=
"20dp"
android:textStyle=
"bold"
/>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Ubon Terminal"
android:textColor=
"@color/gray_800"
android:textSize=
"26dp"
android:textStyle=
"bold"
/>
<!--<RelativeLayout-->
<!--android:layout_gravity="center_vertical"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content">-->
<!--<ImageButton-->
<!--android:layout_alignParentRight="true"-->
<!--android:layout_width="35dp"-->
<!--android:background="@drawable/bg_profile"-->
<!--android:src="@drawable/ic_sort"-->
<!--android:layout_height="35dp" />-->
<!--</RelativeLayout>-->
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"wrap_content"
<View
android:layout_height=
"wrap_content"
android:layout_width=
"match_parent"
android:orientation=
"horizontal"
>
android:layout_height=
"1dp"
android:background=
"@color/gray_100"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"10dp"
android:text=
"From"
android:textColor=
"@color/gray_600"
android:textSize=
"17dp"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Ubon Ratchathani"
android:textColor=
"@color/blue"
android:textSize=
"17dp"
/>
<LinearLayout
</LinearLayout>
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:padding=
"15dp"
>
<LinearLayout
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:orientation=
"horizontal"
>
<RelativeLayout
<RelativeLayout
android:layout_width=
"45dp"
android:layout_width=
"25dp"
android:layout_height=
"45dp"
android:layout_height=
"25dp"
android:layout_marginRight=
"6dp"
android:background=
"@drawable/bus_color_icon_red"
android:background=
"@drawable/bus_color_icon_red"
android:padding=
"
10
dp"
>
android:padding=
"
6
dp"
>
<ImageView
<ImageView
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:src=
"@drawable/ic_frontal_bus_silhouette_white"
/>
android:src=
"@drawable/ic_frontal_bus_silhouette_white"
/>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"16dp"
android:orientation=
"vertical"
>
<
Linear
Layout
<
Relative
Layout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Your Bus"
android:textColor=
"@color/gray_500"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
<TextView
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"สาย ม."
android:text=
"สาย ม."
android:textColor=
"@color/gray_900"
android:textColor=
"@color/gray_600"
android:textSize=
"22dp"
android:textSize=
"17dp"
/>
android:textStyle=
""
/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:background="@drawable/bg_destination_driver"-->
<!--android:orientation="vertical"-->
<!--android:padding="0dp">-->
<!--<LinearLayout-->
<!--android:background="@drawable/bg_ongoing"-->
<!--android:padding="8dp"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content">-->
<!--<TextView-->
<!--android:text="On Going"-->
<!--android:textSize="18dp"-->
<!--android:textStyle="bold"-->
<!--android:textColor="@color/white"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content" />-->
<!--</LinearLayout>-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:padding="15dp">-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="horizontal">-->
<!--<!–<LinearLayout–>-->
<!--<!–android:layout_width="wrap_content"–>-->
<!--<!–android:layout_height="wrap_content"–>-->
<!--<!–android:layout_gravity="center_vertical"–>-->
<!--<!–android:layout_marginRight="25dp">–>-->
<!--<!–<TextView–>-->
<!--<!–android:layout_width="wrap_content"–>-->
<!--<!–android:layout_height="wrap_content"–>-->
<!--<!–android:text="On Going"–>-->
<!--<!–android:textColor="@color/green"–>-->
<!--<!–android:textSize="30dp"–>-->
<!--<!–android:textStyle="bold" />–>-->
<!--<!–</LinearLayout>–>-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical">-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content">-->
<!--<ImageView-->
<!--android:id="@+id/ic_start_circle"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_gravity="center_vertical"-->
<!--android:layout_toStartOf="@+id/text_start"-->
<!--android:src="@drawable/ic_start_black_24dp" />-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="15dp"-->
<!--android:orientation="vertical">-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Start Location"-->
<!--android:textColor="@color/gray_900"-->
<!--android:textStyle="bold" />-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Ubon Ratchathani"-->
<!--android:textColor="@color/gray_600"-->
<!--android:textSize="20dp"-->
<!--android:textStyle="bold" />-->
<!--</LinearLayout>-->
<!--</LinearLayout>-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content">-->
<!--<ImageView-->
<!--android:id="@+id/ic_line"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_toStartOf="@+id/text_start"-->
<!--android:src="@drawable/ic_more_vert_black_24dp" />-->
<!--</LinearLayout>-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content">-->
<!--<ImageView-->
<!--android:id="@+id/ic_stop_circle"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_gravity="center_vertical"-->
<!--android:layout_toStartOf="@+id/text_start"-->
<!--android:src="@drawable/ic_stop_black_24dp" />-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="15dp"-->
<!--android:orientation="vertical">-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Your Destination"-->
<!--android:textColor="@color/gray_900"-->
<!--android:textStyle="bold" />-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Terminal Ubon"-->
<!--android:textColor="@color/gray_600"-->
<!--android:textSize="20dp"-->
<!--android:textStyle="bold" />-->
<!--</LinearLayout>-->
<!--</LinearLayout>-->
<!--</LinearLayout>-->
<!--</LinearLayout>-->
<!--</LinearLayout>-->
<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="1dp"-->
<!--android:background="@color/gray_100" />-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="horizontal"-->
<!--android:padding="15dp">-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content">-->
<!--<RelativeLayout-->
<!--android:layout_width="45dp"-->
<!--android:layout_height="45dp"-->
<!--android:background="@drawable/bus_color_icon_red"-->
<!--android:padding="10dp">-->
<!--<ImageView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:src="@drawable/ic_frontal_bus_silhouette_white" />-->
<!--</RelativeLayout>-->
<!--</LinearLayout>-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_marginLeft="16dp"-->
<!--android:orientation="vertical">-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content">-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Your Bus"-->
<!--android:textColor="@color/gray_500" />-->
<!--</LinearLayout>-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content">-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="สาย ม."-->
<!--android:textColor="@color/gray_900"-->
<!--android:textSize="22dp"-->
<!--android:textStyle="" />-->
<!--</LinearLayout>-->
<!--</LinearLayout>-->
<!--</LinearLayout>-->
<!--</LinearLayout>-->
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -335,10 +479,10 @@
...
@@ -335,10 +479,10 @@
android:gravity=
"left|center_vertical"
android:gravity=
"left|center_vertical"
android:padding=
"15dp"
android:padding=
"15dp"
android:text=
"Return"
android:text=
"Return"
android:visibility=
"gone"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"20dp"
android:textSize=
"20dp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
android:visibility=
"gone"
/>
<Button
<Button
android:id=
"@+id/btn_endtrip"
android:id=
"@+id/btn_endtrip"
...
@@ -353,24 +497,24 @@
...
@@ -353,24 +497,24 @@
android:text=
"End Trip"
android:text=
"End Trip"
android:textColor=
"@color/gray_500"
android:textColor=
"@color/gray_500"
android:textSize=
"20dp"
android:textSize=
"20dp"
android:
visibility=
"gone
"
android:
textStyle=
"bold
"
android:
textStyle=
"bold
"
/>
android:
visibility=
"gone
"
/>
<Button
<Button
android:visibility=
"gone"
android:id=
"@+id/btn_active_bus"
android:id=
"@+id/btn_active_bus"
style=
"?android:attr/borderlessButtonStyle"
style=
"?android:attr/borderlessButtonStyle"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
android:background=
"@drawable/bg_btn_activebus"
android:background=
"@drawable/bg_btn_activebus"
android:padding=
"15dp"
android:drawableRight=
"@drawable/icon_active_clicked"
android:drawableRight=
"@drawable/ic_wifi_bus"
android:gravity=
"left|center_vertical"
android:gravity=
"left|center_vertical"
android:padding=
"15dp"
android:text=
"Active Bus"
android:text=
"Active Bus"
android:textColor=
"@
color/white
"
android:textColor=
"@
drawable/text_active_color
"
android:textSize=
"20dp"
android:textSize=
"20dp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
android:visibility=
"gone"
/>
</LinearLayout>
</LinearLayout>
...
@@ -381,10 +525,10 @@
...
@@ -381,10 +525,10 @@
</LinearLayout>
</LinearLayout>
<!--<FrameLayout-->
<!--<FrameLayout-->
<!--android:id="@+id/view_cover"-->
<!--android:id="@+id/view_cover"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:foreground="@drawable/shape_window_dim">-->
<!--android:foreground="@drawable/shape_window_dim">-->
<!--</FrameLayout>-->
<!--</FrameLayout>-->
...
...
app/src/main/res/values/colors.xml
View file @
7959a8fa
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
<color
name=
"gray_500"
>
#9E9E9E
</color>
<color
name=
"gray_500"
>
#9E9E9E
</color>
<color
name=
"gray_400"
>
#BDBDBD
</color>
<color
name=
"gray_400"
>
#BDBDBD
</color>
<color
name=
"gray_600"
>
#757575
</color>
<color
name=
"gray_600"
>
#757575
</color>
<color
name=
"gray_800"
>
#424242
</color>
<color
name=
"gray_900"
>
#212121
</color>
<color
name=
"gray_900"
>
#212121
</color>
...
...
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