Guest User

Untitled

a guest
Jan 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. private String drawRuning = off; -------------- that
  2.  
  3.  
  4.  
  5. location_switch = (MaterialAnimatedSwitch) findViewById(R.id.location_switch);
  6. location_switch.setOnCheckedChangeListener(new MaterialAnimatedSwitch.OnCheckedChangeListener() {
  7. @Override
  8. public void onCheckedChanged(boolean isOnline) {
  9.  
  10. if (isOnline){
  11.  
  12. FirebaseDatabase.getInstance().goOnline();
  13.  
  14. StartLocationUpdate();
  15. Displaylocation();
  16. Snackbar.make(mapFragment.getView(),"You Are Online",Snackbar.LENGTH_SHORT).show();
  17.  
  18. }else {
  19. FirebaseDatabase.getInstance().goOffline();
  20.  
  21. StoplocationUpdates();
  22. mCurrent.remove();
  23. mMap.clear();
  24. if (drawRuning.equals("on")){ ---------------- that
  25. drawRuning = "off"; ------------------------- that
  26. handler.removeCallbacks(drawPathRunnable); --- -- because that
  27. Snackbar.make(mapFragment.getView(),"You Are Offline",Snackbar.LENGTH_SHORT).show();
  28. }else {
  29. Snackbar.make(mapFragment.getView(),"You Are Offline",Snackbar.LENGTH_SHORT).show();
  30. }
  31. }
  32. }
  33. });
  34.  
  35.  
  36.  
  37. and in
  38.  
  39.  
  40. private void getDirection() {
  41.  
  42. if (drawRuning.equals("off")) { ------------ that
  43.  
  44. drawRuning = "on"; ------------ that
Add Comment
Please, Sign In to add comment