diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2e41cf2..eca7b0a 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -23,6 +23,10 @@
+
+
+
+
diff --git a/res/drawable-hdpi/ic_menu_dialog.png b/res/drawable-hdpi/ic_menu_dialog.png
new file mode 100755
index 0000000..ee6e685
Binary files /dev/null and b/res/drawable-hdpi/ic_menu_dialog.png differ
diff --git a/res/drawable-ldpi/ic_menu_dialog.png b/res/drawable-ldpi/ic_menu_dialog.png
new file mode 100755
index 0000000..efa71ea
Binary files /dev/null and b/res/drawable-ldpi/ic_menu_dialog.png differ
diff --git a/res/drawable-mdpi/ic_menu_dialog.png b/res/drawable-mdpi/ic_menu_dialog.png
new file mode 100755
index 0000000..48a3851
Binary files /dev/null and b/res/drawable-mdpi/ic_menu_dialog.png differ
diff --git a/res/layout/inbox.xml b/res/layout/inbox.xml
new file mode 100755
index 0000000..9bd2a9b
--- /dev/null
+++ b/res/layout/inbox.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/inbox_item.xml b/res/layout/inbox_item.xml
new file mode 100755
index 0000000..4c2b669
--- /dev/null
+++ b/res/layout/inbox_item.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/menu/mainmenu.xml b/res/menu/mainmenu.xml
index 4242500..8c7c0f9 100755
--- a/res/menu/mainmenu.xml
+++ b/res/menu/mainmenu.xml
@@ -9,10 +9,14 @@
-
+
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 00fd2e7..3165203 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6,4 +6,5 @@
Check Messages
Help
Retry
+ Fwd Inbox...
diff --git a/src/org/envaya/kalsms/ForwardInbox.java b/src/org/envaya/kalsms/ForwardInbox.java
new file mode 100755
index 0000000..7f9226e
--- /dev/null
+++ b/src/org/envaya/kalsms/ForwardInbox.java
@@ -0,0 +1,69 @@
+
+package org.envaya.kalsms;
+
+import android.app.ListActivity;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.ListView;
+import android.widget.SimpleCursorAdapter;
+import android.widget.TextView;
+
+
+public class ForwardInbox extends ListActivity {
+
+ private App app;
+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+
+ app = App.getInstance(getApplicationContext());
+
+ setContentView(R.layout.inbox);
+
+ // undocumented API; see
+ // core/java/android/provider/Telephony.java
+
+ Uri inboxUri = Uri.parse("content://sms/inbox");
+
+ Cursor cur = getContentResolver().query(inboxUri, null, null, null, null);
+
+ SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
+ R.layout.inbox_item,
+ cur,
+ new String[] {"address","body"},
+ new int[] {R.id.inbox_address, R.id.inbox_body});
+
+ setListAdapter(adapter);
+ }
+
+ public void forwardSelected(View view) {
+
+ ListView listView = getListView();
+
+ // there is probably a less hacky way to do this...
+ int childCount = listView.getChildCount();
+ for (int i = 0; i < childCount; i++)
+ {
+ View entry = listView.getChildAt(i);
+ CheckBox checkbox = (CheckBox) entry.findViewById(R.id.inbox_checkbox);
+
+ if (checkbox.isChecked())
+ {
+ TextView addressView = (TextView) entry.findViewById(R.id.inbox_address);
+ TextView bodyView = (TextView) entry.findViewById(R.id.inbox_body);
+ IncomingMessage sms = new IncomingMessage(app,
+ addressView.getText().toString(),
+ bodyView.getText().toString());
+
+ app.forwardToServer(sms);
+ }
+ }
+
+ this.finish();
+ }
+}
diff --git a/src/org/envaya/kalsms/Help.java b/src/org/envaya/kalsms/Help.java
index 9c43ff5..1e67c8e 100755
--- a/src/org/envaya/kalsms/Help.java
+++ b/src/org/envaya/kalsms/Help.java
@@ -42,7 +42,7 @@ public class Help extends Activity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- startActivity(new Intent(this, Main.class));
+ this.finish();
return(true);
}
diff --git a/src/org/envaya/kalsms/IncomingMessage.java b/src/org/envaya/kalsms/IncomingMessage.java
index 73a09d4..1807c86 100755
--- a/src/org/envaya/kalsms/IncomingMessage.java
+++ b/src/org/envaya/kalsms/IncomingMessage.java
@@ -7,30 +7,40 @@ import org.apache.http.message.BasicNameValuePair;
public class IncomingMessage extends QueuedMessage {
- public SmsMessage sms;
+ public String from;
+ public String message;
+ public long timestampMillis = 0;
public IncomingMessage(App app, SmsMessage sms) {
super(app);
- this.sms = sms;
+ this.from = sms.getOriginatingAddress();
+ this.message = sms.getMessageBody();
+ this.timestampMillis = sms.getTimestampMillis();
}
+
+ public IncomingMessage(App app, String from, String message) {
+ super(app);
+ this.from = from;
+ this.message = message;
+ }
public String getMessageBody()
{
- return sms.getMessageBody();
+ return message;
}
public String getFrom()
{
- return sms.getOriginatingAddress();
+ return from;
}
public String getId()
{
- return sms.getOriginatingAddress() + ":" + sms.getMessageBody() + ":" + sms.getTimestampMillis();
+ return from + ":" + message + ":" + timestampMillis;
}
public void retryNow() {
- app.log("Retrying forwarding SMS from " + sms.getOriginatingAddress());
+ app.log("Retrying forwarding SMS from " + from);
tryForwardToServer();
}
diff --git a/src/org/envaya/kalsms/Main.java b/src/org/envaya/kalsms/Main.java
index 644135a..fc447b1 100755
--- a/src/org/envaya/kalsms/Main.java
+++ b/src/org/envaya/kalsms/Main.java
@@ -132,7 +132,10 @@ public class Main extends Activity {
return true;
case R.id.retry_now:
app.retryStuckMessages();
- return true;
+ return true;
+ case R.id.forward_inbox:
+ startActivity(new Intent(this, ForwardInbox.class));
+ return true;
case R.id.help:
startActivity(new Intent(this, Help.class));
return true;
diff --git a/src/org/envaya/kalsms/Prefs.java b/src/org/envaya/kalsms/Prefs.java
index de1c98a..b46ff71 100755
--- a/src/org/envaya/kalsms/Prefs.java
+++ b/src/org/envaya/kalsms/Prefs.java
@@ -93,17 +93,10 @@ public class Prefs extends PreferenceActivity implements OnSharedPreferenceChang
}
}
- // first time the Menu key is pressed
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- startActivity(new Intent(this, Prefs.class));
- return (true);
- }
-
// any other time the Menu key is pressed
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
- startActivity(new Intent(this, Prefs.class));
+ this.finish();
return (true);
}
}