Author: jerome
Date: 2009-12-24 19:07:15 +0100 (Thu, 24 Dec 2009)
New Revision: 6013

Modified:
   
software_suite_v3/software/plugin/plugin-facebook/branches/dynamic_sentences/src/com/kysoh/plugins/facebook/FacebookPlugin.java
Log:
* Added random sentences.
* Added pick sentence function.

Merry Christmas to TuxDroid users.

Modified: 
software_suite_v3/software/plugin/plugin-facebook/branches/dynamic_sentences/src/com/kysoh/plugins/facebook/FacebookPlugin.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-facebook/branches/dynamic_sentences/src/com/kysoh/plugins/facebook/FacebookPlugin.java
     2009-12-24 17:23:52 UTC (rev 6012)
+++ 
software_suite_v3/software/plugin/plugin-facebook/branches/dynamic_sentences/src/com/kysoh/plugins/facebook/FacebookPlugin.java
     2009-12-24 18:07:15 UTC (rev 6013)
@@ -22,6 +22,7 @@
 
 package com.kysoh.plugins.facebook;
 
+import java.util.Random;
 import java.util.Vector;
 
 import com.kysoh.tuxdroid.plugin.framework.plugin.SimplePlugin;
@@ -35,13 +36,68 @@
 public class FacebookPlugin extends SimplePlugin<PluginFacebookConfiguration>{
        
        private boolean thrown = false;
-       
-       
        private boolean secondCycle = false;
        
        private FacebookFunctions functions;
        private FacebookDatasStruct facebookHistory;
        
+       private String[] noNewFriend = {"You don't have any friend requests",
+                                               "I didn't find any friend 
requests",
+                                               "There are no new friend 
requests",
+                                               "No one asked to be your 
friend"};
+       
+       private String[] newFriend = {"{0} requests to be your friend",
+                                             "{0} asks to be your friend",
+                                             "{0} wants to have you as a 
friend",
+                                             "{0} wants to add you to his 
friend list"};
+       
+       private String[] noNewMessage = {"You don't have any messages",
+                                                "I couldn't find any new 
messages",
+                                                "There are no new private 
messages detected",
+                                                "No private messages 
detected"};
+       
+       private String[] newSingleMessage = {"You have one new message",
+                                                    "You received one new 
message",
+                                                    "I detected a new message",
+                                                    "You received only one 
message",
+                                                    "I found a new message on 
your Facebook account"};
+       
+       private String[] newMultipleMessage = {"You have {0} messages",
+                                                      "You received {0} new 
messages",
+                                                      "I detected {0} new 
messages on your Facebook account",
+                                                      "There are {0} new 
messages available",
+                                                      "You received {0} 
private messages"};
+       
+       
+       private String[] errorConnections = {"You do not seem to be connected. 
Please, verify your user name and password, then try again.",
+                                                    "I am not able to connect. 
Please, check your user name and password in the gadget configuration.",
+                                                    "I could not connect to 
Facebook. Check your user name and password and try again.",
+                                                    "I got an error when 
connecting to your Facebook. Please, verify your user name and password in the 
gadget configuration."};
+       
+       private String[] noNewEvent = {"You don't have any event invites",
+                                              "I didn't find any event 
invites",
+                                              "You didn't receive any new 
event invites",
+                                              "You have no new group invites",
+                                              "There are no new group invites 
available"};
+       
+       private String[] newEvent = {"You are invited to the event: {0}",
+                                            "You received an invitation to the 
following event: {0}",
+                                            "I found an event invite from: 
{0}",
+                                            "You are invited to an event: {0}",
+                                            "I detected a new event invite 
from: {0}"};
+       
+       private String[] noNewGroup = {"You don't have any group invites",
+                                              "I didn't find any group 
invites",
+                                              "There are no new group invites",
+                                              "You didn't receive new group 
invites",
+                                              "You are not invited to any new 
groups"};
+       
+       private String[] newGroup = {"You are invited to this group: {0}",
+                                            "You received an invitation for 
the following group: {0}",
+                                            "You got a group invitation for: 
{0}",
+                                            "You received an invite for the 
group: {0}",
+                                            "I have received a group invite 
for: {0}"};
+       
        /**
         * Throws the result in case of Check mode.
         */
@@ -94,6 +150,16 @@
        
        
        /**
+     * This function return a sentences from a defined list
+     */
+   private String pickSentence(String[] list) 
+   {
+       Random rand = new Random();
+       return list[rand.nextInt(list.length)];
+   }
+       
+       
+       /**
         * Start run or check command.
         */
        public void RunOrCheck()


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Tux-droid-svn mailing list
Tux-droid-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to