Author: jerome
Date: 2009-07-08 12:48:49 +0200 (Wed, 08 Jul 2009)
New Revision: 5083

Modified:
   
software_suite_v3/software/plugin/plugin-programsTv/trunk/plugin-programsTv/src/com/kysoh/tvPrograms/plugin/PluginProgramTV.java
Log:
* Fixed a possible tts output bug related to the '&' character 

Modified: 
software_suite_v3/software/plugin/plugin-programsTv/trunk/plugin-programsTv/src/com/kysoh/tvPrograms/plugin/PluginProgramTV.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-programsTv/trunk/plugin-programsTv/src/com/kysoh/tvPrograms/plugin/PluginProgramTV.java
    2009-07-08 10:19:07 UTC (rev 5082)
+++ 
software_suite_v3/software/plugin/plugin-programsTv/trunk/plugin-programsTv/src/com/kysoh/tvPrograms/plugin/PluginProgramTV.java
    2009-07-08 10:48:49 UTC (rev 5083)
@@ -42,13 +42,27 @@
                        Program nowPlaying = 
SimplePrograms.getNowPlaying(programme);
                        if(nowPlaying != null)
                        {
-                               gadget.throwMessage("Now playing on {0}. {1}", 
nowPlaying.getChannel(), nowPlaying.getTitle());
+                               String np = nowPlaying.getTitle();
                                
+                               if(np.contains("&"))
+                               {
+                                       np = np.replace("&", "&&");
+                               }
+                               
+                               gadget.throwMessage("Now playing on {0}. {1}", 
nowPlaying.getChannel(), np);
+                               
                                Program nextPlaying = 
SimplePrograms.getNextPlaying(programme, nowPlaying);
                                
                                if(nextPlaying != null)
                                {
-                                       gadget.throwMessage("Next playing {0} 
at {1}", nextPlaying.getTitle(), nextPlaying.getStartTime());
+                                       np = nextPlaying.getTitle();
+                                       
+                                       if(np.contains("&"))
+                                       {
+                                               np = np.replace("&", "&&");
+                                       }
+                                       
+                                       gadget.throwMessage("Next playing {0} 
at {1}", np, nextPlaying.getStartTime());
                                }
                                
                        }
@@ -58,6 +72,9 @@
                        }
                }
        
+               String channel = "";
+               String title = "";
+               
                //Morning program.
                if(configuration.getGiveMorning())
                {
@@ -65,7 +82,13 @@
                        
                        if(!configuration.getGiveNowPlaying())
                        {
-                               gadget.throwMessage("On {0}", 
programme.get(0).getChannel());
+                               channel = programme.get(0).getChannel();
+                               if(channel.contains("&"))
+                               {
+                                       channel = channel.replace("&", "&&");
+                               }
+                               
+                               gadget.throwMessage("On {0}", channel);
                        }
                        
                        Vector<Program> morning = 
SimplePrograms.sortMorning(programme);
@@ -79,11 +102,21 @@
                        {
                                if(!configuration.getGiveProgramDescription() 
|| (oneProgram.getDescription().equalsIgnoreCase("undefined")))
                                {
-                                       gadget.throwMessage("{0}, {1}", 
oneProgram.getStartTime(), oneProgram.getTitle());
+                                       title = oneProgram.getTitle();
+                                       if(title.contains("&"))
+                                       {
+                                               title = title.replace("&", 
"&&");
+                                       }
+                                       gadget.throwMessage("{0}, {1}", 
oneProgram.getStartTime(), title);
                                }
                                else
                                {
-                                       gadget.throwMessage("{0}, {1}, {2}", 
oneProgram.getStartTime(), oneProgram.getTitle(), oneProgram.getDescription());
+                                       title = oneProgram.getTitle();
+                                       if(title.contains("&"))
+                                       {
+                                               title = title.replace("&", 
"&&");
+                                       }
+                                       gadget.throwMessage("{0}, {1}, {2}", 
oneProgram.getStartTime(), title, oneProgram.getDescription());
                                }
                        }
                }
@@ -95,7 +128,12 @@
                        
                        if(!configuration.getGiveNowPlaying())
                        {
-                               gadget.throwMessage("On {0}", 
programme.get(0).getChannel());
+                               channel = programme.get(0).getChannel();
+                               if(channel.contains("&"))
+                               {
+                                       channel = channel.replace("&", "&&");
+                               }
+                               gadget.throwMessage("On {0}", channel);
                        }
                        
                        Vector<Program> afternoon = 
SimplePrograms.sortAfternoon(programme);
@@ -110,11 +148,21 @@
                                
                                if(!configuration.getGiveProgramDescription() 
|| (oneProgram.getDescription().equalsIgnoreCase("undefined")))
                                {
-                                       gadget.throwMessage("{0}, {1}", 
oneProgram.getStartTime(), oneProgram.getTitle());
+                                       title = oneProgram.getTitle();
+                                       if(title.contains("&"))
+                                       {
+                                               title = title.replace("&", 
"&&");
+                                       }
+                                       gadget.throwMessage("{0}, {1}", 
oneProgram.getStartTime(), title);
                                }
                                else
                                {
-                                       gadget.throwMessage("{0}, {1}, {2}", 
oneProgram.getStartTime(), oneProgram.getTitle(), oneProgram.getDescription());
+                                       title = oneProgram.getTitle();
+                                       if(title.contains("&"))
+                                       {
+                                               title = title.replace("&", 
"&&");
+                                       }
+                                       gadget.throwMessage("{0}, {1}, {2}", 
oneProgram.getStartTime(), title , oneProgram.getDescription());
                                }
                        }
                }
@@ -126,7 +174,12 @@
                        
                        if(!configuration.getGiveNowPlaying())
                        {
-                               gadget.throwMessage("On {0}", 
programme.get(0).getChannel());
+                               channel = programme.get(0).getChannel();
+                               if(channel.contains("&"))
+                               {
+                                       channel = channel.replace("&", "&&");
+                               }
+                               gadget.throwMessage("On {0}", channel);
                        }
                        
                        Vector<Program> evening = 
SimplePrograms.sortEvening(programme);
@@ -140,11 +193,21 @@
                        {
                                if(!configuration.getGiveProgramDescription() 
|| (oneProgram.getDescription().equalsIgnoreCase("undefined")))
                                {
-                                       gadget.throwMessage("{0}, {1}", 
oneProgram.getStartTime(), oneProgram.getTitle());
+                                       title = oneProgram.getTitle();
+                                       if(title.contains("&"))
+                                       {
+                                               title = title.replace("&", 
"&&");
+                                       }
+                                       gadget.throwMessage("{0}, {1}", 
oneProgram.getStartTime(), title);
                                }
                                else
                                {
-                                       gadget.throwMessage("{0}, {1}, {2}", 
oneProgram.getStartTime(), oneProgram.getTitle(), oneProgram.getDescription());
+                                       title = oneProgram.getTitle();
+                                       if(title.contains("&"))
+                                       {
+                                               title = title.replace("&", 
"&&");
+                                       }
+                                       gadget.throwMessage("{0}, {1}, {2}", 
oneProgram.getStartTime(), title, oneProgram.getDescription());
                                }
                        }
                }


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to