]> iEval git - fonbot.git/blobdiff - src/ro/ieval/fonbot/Heavy.java
Add OSM links to location updates
[fonbot.git] / src / ro / ieval / fonbot / Heavy.java
index c5c6de7462450b04f5529aaf38dc6621216e7991..c06234d7ac35a2a9ec1e97ab641d970f91840438 100644 (file)
@@ -168,6 +168,12 @@ final class Heavy {
                        sb.append(toNonNull(context.getString(at)));
                        sb.append(" ");
                        sb.append(locationDate.toString());
+                       sb.append(". ");
+
+                       sb.append("http://openstreetmap.org/?zoom=15&mlat=");
+                       sb.append(loc.getLatitude());
+                       sb.append("&mlon=");
+                       sb.append(loc.getLongitude());
                        Utils.sendMessage(toNonNull(context), toNonNull(replyTo), toNonNull(sb.toString()));
                }
 
@@ -503,6 +509,9 @@ final class Heavy {
                case SCREENCAP:
                        Utils.sendMessage(context, replyTo, screencap_help);
                        break;
+               case TORCH:
+                       Utils.sendMessage(context, replyTo, torch_help);
+                       break;
                }
        }
 
@@ -734,9 +743,6 @@ final class Heavy {
                case LOCATION:
                        nolocation(context, toNonNull(Address.BLACKHOLE));
                        break;
-               case POLL:
-                       poll(context, toNonNull(Address.BLACKHOLE), 0);
-                       break;
                case RING:
                        ring(context, toNonNull(Address.BLACKHOLE), false);
                        break;
@@ -1545,30 +1551,7 @@ final class Heavy {
         */
        public static void poll(final Context context, final Address replyTo) {
                Utils.sendMessage(context, replyTo, polling_server);
-               Utils.pollServer(context);
-       }
-
-       /**
-        * Change the server poll interval.
-        *
-        * @param context Context instance
-        * @param replyTo reply Address
-        * @param ms server poll interval in milliseconds. If 0, server poll is disabled
-        */
-       public static void poll(final Context context, final Address replyTo, final long ms){
-               final AlarmManager man=(AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
-               final Intent pollAlarm=new Intent(context, FonBotMainService.class);
-               pollAlarm.setAction(FonBotMainService.ACTION_TRIGGER_POLL);
-               final PendingIntent intent=PendingIntent.getService(context, 0, pollAlarm, 0);
-               if(ms==0){
-                       Utils.unregisterOngoing(context, toNonNull(OngoingEvent.POLL));
-                       man.cancel(intent);
-                       Utils.sendMessage(context, replyTo, polling_stopped);
-               } else {
-                       Utils.registerOngoing(context, toNonNull(OngoingEvent.POLL));
-                       man.setRepeating(AlarmManager.RTC_WAKEUP, 0, ms, intent);
-                       Utils.sendMessage(context, replyTo, polling_every_milliseconds, Long.valueOf(ms));
-               }
+               context.startService(new Intent(context, FonBotMainService.class));
        }
 
        /**
@@ -1791,4 +1774,15 @@ final class Heavy {
        public static void screencap(final Context context, final Address replyTo, final String filename){
                new Thread(new ScreencapRunnable(context, replyTo, filename)).start();
        }
+
+       /**
+        * Toggle the torch state using the Torch (net.cactii.torch2) app.
+        *
+        * @param context Context instance
+        * @param replyTo reply Address
+        */
+       public static void torch(final Context context, final Address replyTo){
+               context.sendBroadcast(new Intent("net.cactii.flash2.TOGGLE_FLASHLIGHT"));
+               Utils.sendMessage(context, replyTo, toggling_torch_state);
+       }
 }
This page took 0.025746 seconds and 4 git commands to generate.