Subversion Repository Public Repository

Nextrek

Diff Revisions 546 vs 548 for /Android/SmartCharging/SmartCharging/app/src/main/java/it/fedeloper/smartcharging/Manager/MyLocation.java

Diff revisions: vs.
  @@ -37,35 +37,24 @@
37 37 * @param context context (this in Activity / getActivity() in Fragment)
38 38 * @return true if gps is enabled
39 39 */
40 - public static boolean isGpsEnabled(final Context context){
40 + public static boolean isGpsEnabled(final Context context) {
41 41 LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
42 42 Boolean isGpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
43 - if(!isGpsEnabled)
44 - {
43 + if (!isGpsEnabled) {
45 44 Utils.toast(context, R.string.enable_gps_toast);
46 - if (countGps==0)
47 - countGps++;
48 - else if(countGps==1)
49 - {
50 - countGps++;
51 - /*final int interval = 2000;
52 - Handler handler = new Handler();
53 - Runnable runnable = new Runnable(){
54 - public void run() {
55 - Intent gpsOptionsIntent = new Intent(
56 - android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
57 - context.startActivity(gpsOptionsIntent);
58 - }
59 - };
60 - handler.postDelayed(runnable, interval);
61 - */
62 - }
45 + if (countGps == 0)
46 + countGps++;
47 + else if (countGps == 1) {
48 + countGps++;
63 49
64 - }
65 50
51 + }
52 +
53 +
54 + }
66 55 return isGpsEnabled;
67 - }
68 56
57 + }
69 58 static LocationListener locationListenerPassive = new LocationListener() {
70 59 public void onLocationChanged(Location location) {
71 60 timer1.cancel();