Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
78ab52c3
Commit
78ab52c3
authored
Dec 01, 2012
by
halatmit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tooltips to texting component properties
Change-Id: I1495d8c6f7221f339e9614450a7049871a6f96df
parent
9ace9635
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
31 deletions
+59
-31
appinventor/components/src/com/google/appinventor/components/runtime/Texting.java
...rc/com/google/appinventor/components/runtime/Texting.java
+59
-31
No files found.
appinventor/components/src/com/google/appinventor/components/runtime/Texting.java
View file @
78ab52c3
...
@@ -62,23 +62,28 @@ import android.widget.Toast;
...
@@ -62,23 +62,28 @@ import android.widget.Toast;
" method is called, send the text message "
+
" method is called, send the text message "
+
"specified in the <code>Message</code> property to the phone number "
+
"specified in the <code>Message</code> property to the phone number "
+
"specified in the <code>PhoneNumber</code> property. "
+
"specified in the <code>PhoneNumber</code> property. "
+
"<p>This component
can also receive text messages unless
the "
+
"<p>This component
will also receive text messages if
the "
+
"<code>ReceivingEnabled</code> property is
Fals
e. When a message "
+
"<code>ReceivingEnabled</code> property is
Tru
e. When a message "
+
"arrives, the <code>MessageReceived</code> event is raised and provides "
+
"arrives, the <code>MessageReceived</code> event is raised and provides "
+
"the sending number and message.</p>"
+
"the sending number and message.</p>"
+
"<p>If the GoogleVoiceEnabled property is true, messages can be sent and received "
+
"<p> An app that includes this component will receive messages even "
+
"over Wifi. This option requires that the user have a Google Voice account and "
+
"when it is in the background (i.e. when it's not visible on the screen) and, moreso, "
+
"that the mobile Voice app is installed on the phone. This option works only on "
+
"even if the app is not running, so long as it's installed on the phone. If the phone "
+
"phones that support Android 2.0 (Eclair) or higher. </p>"
+
"receives a text message when the app is not in the foreground, the phone will show a "
+
"<p>Often, this component is used with the <code>ContactPicker</code> "
+
"notification in the notification bar. Selecting the notification will bring up the app."
+
"component, which lets the user select a contact from the ones stored "
+
"As an app developer, you'll probably want to give your users the ability to control "
+
"on the phone and sets the <code>PhoneNumber</code> property to the "
+
"ReceivingEnabled so that they can make the phone ignore text messages."
+
"contact's phone number.</p>"
+
"<p>If the GoogleVoiceEnabled property is true, messages can be sent "
+
"<p>To directly specify the phone number (e.g., 650-555-1212), set "
+
"over Wifi using Google Voice. This option requires that the user have a Google Voice "
+
"the <code>PhoneNumber</code> property to a Text with the specified "
+
"account and that the mobile Voice app is installed on the phone. The Google Voice "
+
"digits (e.g., \"6505551212\"). Dashes, dots, and parentheses may be "
+
"option works only on phones that support Android 2.0 (Eclair) or higher. </p>"
+
"included (e.g., \"(650)-555-1212\") but will be ignored; spaces may "
+
"<p>To specify the phone number (e.g., 650-555-1212), set "
+
"not be included.</p>"
,
"the <code>PhoneNumber</code> property to a Text string with the specified "
+
"digits (e.g., 6505551212). Dashes, dots, and parentheses may be "
+
"included (e.g., (650)-555-1212) but will be ignored; spaces may not be included.</p>"
+
"<p>Another way for an app to specify a phone number would be to include "
+
"a <code>PhoneNumberPicker</code> component, which lets the users select a phone numbers "
+
"from the ones stored in the the phone's contacts.</p>"
,
category
=
ComponentCategory
.
SOCIAL
,
category
=
ComponentCategory
.
SOCIAL
,
nonVisible
=
true
,
nonVisible
=
true
,
iconName
=
"images/texting.png"
)
iconName
=
"images/texting.png"
)
...
@@ -114,7 +119,7 @@ import android.widget.Toast;
...
@@ -114,7 +119,7 @@ import android.widget.Toast;
public
static
final
String
GV_URL
=
"https://www.google.com/voice/b/0"
;
public
static
final
String
GV_URL
=
"https://www.google.com/voice/b/0"
;
// Meta data key and value that identify an app for handling incoming S
ms
// Meta data key and value that identify an app for handling incoming S
MS
// Used by Texting component
// Used by Texting component
public
static
final
String
META_DATA_SMS_KEY
=
"sms_handler_component"
;
public
static
final
String
META_DATA_SMS_KEY
=
"sms_handler_component"
;
public
static
final
String
META_DATA_SMS_VALUE
=
"Texting"
;
public
static
final
String
META_DATA_SMS_VALUE
=
"Texting"
;
...
@@ -220,26 +225,35 @@ import android.widget.Toast;
...
@@ -220,26 +225,35 @@ import android.widget.Toast;
}
}
/**
/**
* Get the phone number that the message will be sent to when the SendMessage function is called.
* The number that the message will be sent to when the SendMessage method is called. The
*/
* number is a text string with the specified digits (e.g., 6505551212). Dashes, dots,
@SimpleProperty
* and parentheses may be included (e.g., (650)-555-1212) but will be ignored; spaces
* should not be included.
*/
@SimpleProperty
(
category
=
PropertyCategory
.
BEHAVIOR
,
description
=
"The number that the message will be sent to when the SendMessage method "
+
"is called. The "
+
"number is a text string with the specified digits (e.g., 6505551212). Dashes, dots, "
+
"and parentheses may be included (e.g., (650)-555-1212) but will be ignored; spaces "
+
"should not be included."
)
public
String
PhoneNumber
()
{
public
String
PhoneNumber
()
{
return
phoneNumber
;
return
phoneNumber
;
}
}
/**
/**
*
Sets the text message to send when the SendMessage function
is called.
*
The text message to that will be sent when the SendMessage method
is called.
*
*
* @param message the message to send when the SendMessage function is called.
* @param message the message to send when the SendMessage function is called.
*/
*/
@DesignerProperty
(
editorType
=
PropertyTypeConstants
.
PROPERTY_TYPE_STRING
,
defaultValue
=
""
)
@DesignerProperty
(
editorType
=
PropertyTypeConstants
.
PROPERTY_TYPE_STRING
,
defaultValue
=
""
)
@SimpleProperty
(
category
=
PropertyCategory
.
BEHAVIOR
)
@SimpleProperty
(
category
=
PropertyCategory
.
BEHAVIOR
,
description
=
"The message that will be sent when the SendMessage method is called."
)
public
void
Message
(
String
message
)
{
public
void
Message
(
String
message
)
{
this
.
message
=
message
;
this
.
message
=
message
;
}
}
/**
/**
*
Get the message that will be sent when the SendMessage function
is called.
*
The text message that will be sent when the SendMessage method
is called.
*/
*/
@SimpleProperty
@SimpleProperty
public
String
Message
()
{
public
String
Message
()
{
...
@@ -259,10 +273,8 @@ import android.widget.Toast;
...
@@ -259,10 +273,8 @@ import android.widget.Toast;
}
}
/**
/**
* Event that's raised when a
new
text message is received by the phone.
* Event that's raised when a text message is received by the phone.
*
*
* This method shouldn't be called until the app is initialized. If dispatch
* fails, the message is cached.
*
*
* @param number the phone number that the text message was sent from.
* @param number the phone number that the text message was sent from.
* @param messageText the text of the message.
* @param messageText the text of the message.
...
@@ -283,18 +295,25 @@ import android.widget.Toast;
...
@@ -283,18 +295,25 @@ import android.widget.Toast;
}
}
/**
/**
* Gets whether you want to use Google Voice to send/receive messages.
* If this property is true, then SendMessage will attempt to send messages over
* WiFi, using Google voice.
*
*
* @return 'true' or 'false' depending on whether you want to
* @return 'true' or 'false' depending on whether you want to
* use Google Voice for sending/receiving messages.
* use Google Voice for sending/receiving messages.
*/
*/
@SimpleProperty
(
category
=
PropertyCategory
.
BEHAVIOR
)
@SimpleProperty
(
category
=
PropertyCategory
.
BEHAVIOR
,
description
=
"If true, then SendMessage will attempt to send messages over Wifi "
+
"using Google Voice. This requires that the Google Voice app must be installed "
+
"and set up on the phone or tablet, with a Google Voice account. If GoogleVoiceEnabled "
+
"is false, the device must have phone and texting service in order to send or "
+
"receive messages with this component."
)
public
boolean
GoogleVoiceEnabled
()
{
public
boolean
GoogleVoiceEnabled
()
{
return
googleVoiceEnabled
;
return
googleVoiceEnabled
;
}
}
/**
/**
* Sets whether you want to use Google Voice to send/receive messages.
* If this property is true, then SendMessage will attempt to send messages over
* WiFi, using Google voice.
*
*
* @param enabled Set to 'true' or 'false' depending on whether you want to
* @param enabled Set to 'true' or 'false' depending on whether you want to
* use Google Voice to send/receive messages.
* use Google Voice to send/receive messages.
...
@@ -321,7 +340,16 @@ import android.widget.Toast;
...
@@ -321,7 +340,16 @@ import android.widget.Toast;
* {@link #MessageReceived(String,String)} event to get run when a
* {@link #MessageReceived(String,String)} event to get run when a
* new text message is received.
* new text message is received.
*/
*/
@SimpleProperty
(
category
=
PropertyCategory
.
BEHAVIOR
)
@SimpleProperty
(
category
=
PropertyCategory
.
BEHAVIOR
,
description
=
"If true, the component will respond to messages received. If the app "
+
"is in the foreground, the MessageReceived event will be signaled. If the app is "
+
"running in the background, or even not running at all, the phone will show a "
+
"notification. "
+
"Selecting the notification will bring up the app and signal the MessageReceived "
+
"event. Messages received when the app is dormant will be queued, and so "
+
"several ReceivingEnabled event might appear when the app awakens. As an app "
+
"developer, it would be a good idea to give your users control over this property, "
+
"so they can make their phones ignore text messages when your app is installed."
)
public
boolean
ReceivingEnabled
()
{
public
boolean
ReceivingEnabled
()
{
return
receivingEnabled
;
return
receivingEnabled
;
}
}
...
@@ -477,7 +505,7 @@ import android.widget.Toast;
...
@@ -477,7 +505,7 @@ import android.widget.Toast;
}
}
/**
/**
* This method is called by SmsBroadcastRec
i
eiver when a message is received.
* This method is called by SmsBroadcastReceiver when a message is received.
* @param phone
* @param phone
* @param msg
* @param msg
*/
*/
...
@@ -620,7 +648,7 @@ import android.widget.Toast;
...
@@ -620,7 +648,7 @@ import android.widget.Toast;
/**
/**
* Internal method which parses the Homepage source code to determine the
* Internal method which parses the Homepage source code to determine the
* rnrsee variable, this variable is passed into most fuctions for placing
* rnrsee variable, this variable is passed into most fu
n
ctions for placing
* calls and sms.
* calls and sms.
*
*
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
...
@@ -676,7 +704,7 @@ import android.widget.Toast;
...
@@ -676,7 +704,7 @@ import android.widget.Toast;
redirectCounter
++;
redirectCounter
++;
if
(
redirectCounter
>
MAX_REDIRECTS
)
{
if
(
redirectCounter
>
MAX_REDIRECTS
)
{
redirectCounter
=
0
;
redirectCounter
=
0
;
throw
new
IOException
(
urlString
+
" : "
+
conn
.
getResponseMessage
()
+
"("
+
responseCode
+
") : Too man
n
y redirects. exiting."
);
throw
new
IOException
(
urlString
+
" : "
+
conn
.
getResponseMessage
()
+
"("
+
responseCode
+
") : Too many redirects. exiting."
);
}
}
String
location
=
conn
.
getHeaderField
(
"Location"
);
String
location
=
conn
.
getHeaderField
(
"Location"
);
if
(
location
!=
null
&&
!
location
.
equals
(
""
))
{
if
(
location
!=
null
&&
!
location
.
equals
(
""
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment