From 46710c24a72db4b72f20f59b146ec4a830f01d87 Mon Sep 17 00:00:00 2001 From: Jesse Young Date: Thu, 15 Sep 2011 18:34:06 -0700 Subject: [PATCH] organize code into subpackages --- AndroidManifest.xml | 31 +++++++++---------- res/layout/inbox_item.xml | 6 ++-- src/org/envaya/kalsms/App.java | 3 ++ src/org/envaya/kalsms/IncomingMessage.java | 2 ++ src/org/envaya/kalsms/MMSReceiver.java | 22 ------------- src/org/envaya/kalsms/OutgoingMessage.java | 2 ++ .../kalsms/{ => receiver}/BootReceiver.java | 4 ++- .../{ => receiver}/IncomingMessageRetry.java | 3 +- .../envaya/kalsms/receiver/MMSReceiver.java | 27 ++++++++++++++++ .../{ => receiver}/MessageStatusNotifier.java | 4 +-- .../{ => receiver}/OutgoingMessagePoller.java | 3 +- .../{ => receiver}/OutgoingMessageRetry.java | 3 +- .../kalsms/{ => receiver}/SMSReceiver.java | 4 ++- .../kalsms/{ => task}/ForwarderTask.java | 5 ++- .../envaya/kalsms/{ => task}/HttpTask.java | 5 ++- .../envaya/kalsms/{ => task}/PollerTask.java | 5 ++- .../{ => ui}/CheckableRelativeLayout.java | 2 +- .../envaya/kalsms/{ => ui}/ForwardInbox.java | 5 ++- src/org/envaya/kalsms/{ => ui}/Help.java | 4 +-- .../envaya/kalsms/{ => ui}/InertCheckBox.java | 2 +- src/org/envaya/kalsms/{ => ui}/Main.java | 5 ++- src/org/envaya/kalsms/{ => ui}/Prefs.java | 5 +-- 22 files changed, 93 insertions(+), 59 deletions(-) delete mode 100755 src/org/envaya/kalsms/MMSReceiver.java rename src/org/envaya/kalsms/{ => receiver}/BootReceiver.java (86%) rename src/org/envaya/kalsms/{ => receiver}/IncomingMessageRetry.java (86%) create mode 100755 src/org/envaya/kalsms/receiver/MMSReceiver.java rename src/org/envaya/kalsms/{ => receiver}/MessageStatusNotifier.java (92%) rename src/org/envaya/kalsms/{ => receiver}/OutgoingMessagePoller.java (81%) rename src/org/envaya/kalsms/{ => receiver}/OutgoingMessageRetry.java (86%) rename src/org/envaya/kalsms/{ => receiver}/SMSReceiver.java (95%) rename src/org/envaya/kalsms/{ => task}/ForwarderTask.java (86%) rename src/org/envaya/kalsms/{ => task}/HttpTask.java (97%) rename src/org/envaya/kalsms/{ => task}/PollerTask.java (76%) rename src/org/envaya/kalsms/{ => ui}/CheckableRelativeLayout.java (98%) rename src/org/envaya/kalsms/{ => ui}/ForwardInbox.java (94%) rename src/org/envaya/kalsms/{ => ui}/Help.java (96%) rename src/org/envaya/kalsms/{ => ui}/InertCheckBox.java (98%) rename src/org/envaya/kalsms/{ => ui}/Main.java (94%) rename src/org/envaya/kalsms/{ => ui}/Prefs.java (97%) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 961ac86..957994e 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -16,53 +16,52 @@ - + - + - + - - - + + + + + - + - + - + - + - + - + - - - \ No newline at end of file diff --git a/res/layout/inbox_item.xml b/res/layout/inbox_item.xml index a01c7c5..7bd1de4 100755 --- a/res/layout/inbox_item.xml +++ b/res/layout/inbox_item.xml @@ -1,10 +1,10 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/org/envaya/kalsms/App.java b/src/org/envaya/kalsms/App.java index 8b93f99..a9410c6 100755 --- a/src/org/envaya/kalsms/App.java +++ b/src/org/envaya/kalsms/App.java @@ -1,5 +1,8 @@ package org.envaya.kalsms; +import org.envaya.kalsms.task.PollerTask; +import org.envaya.kalsms.task.HttpTask; +import org.envaya.kalsms.receiver.OutgoingMessagePoller; import android.app.Activity; import android.app.AlarmManager; import android.app.Application; diff --git a/src/org/envaya/kalsms/IncomingMessage.java b/src/org/envaya/kalsms/IncomingMessage.java index 30ddf75..5c47c6a 100755 --- a/src/org/envaya/kalsms/IncomingMessage.java +++ b/src/org/envaya/kalsms/IncomingMessage.java @@ -1,5 +1,7 @@ package org.envaya.kalsms; +import org.envaya.kalsms.task.ForwarderTask; +import org.envaya.kalsms.receiver.IncomingMessageRetry; import android.content.Intent; import android.net.Uri; import android.telephony.SmsMessage; diff --git a/src/org/envaya/kalsms/MMSReceiver.java b/src/org/envaya/kalsms/MMSReceiver.java deleted file mode 100755 index 5069046..0000000 --- a/src/org/envaya/kalsms/MMSReceiver.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.envaya.kalsms; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -public class MMSReceiver extends BroadcastReceiver { - - private App app; - - @Override - public void onReceive(Context context, Intent intent) { - app = (App) context.getApplicationContext(); - - if (!app.isEnabled()) - { - return; - } - - app.log("WAP Push received"); - } -} \ No newline at end of file diff --git a/src/org/envaya/kalsms/OutgoingMessage.java b/src/org/envaya/kalsms/OutgoingMessage.java index 092431a..67ae0d1 100755 --- a/src/org/envaya/kalsms/OutgoingMessage.java +++ b/src/org/envaya/kalsms/OutgoingMessage.java @@ -1,6 +1,8 @@ package org.envaya.kalsms; +import org.envaya.kalsms.receiver.OutgoingMessageRetry; +import org.envaya.kalsms.receiver.MessageStatusNotifier; import android.app.PendingIntent; import android.content.Intent; import android.net.Uri; diff --git a/src/org/envaya/kalsms/BootReceiver.java b/src/org/envaya/kalsms/receiver/BootReceiver.java similarity index 86% rename from src/org/envaya/kalsms/BootReceiver.java rename to src/org/envaya/kalsms/receiver/BootReceiver.java index 632f433..8e2e8da 100755 --- a/src/org/envaya/kalsms/BootReceiver.java +++ b/src/org/envaya/kalsms/receiver/BootReceiver.java @@ -1,9 +1,11 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import org.envaya.kalsms.App; +import org.envaya.kalsms.ui.Main; public class BootReceiver extends BroadcastReceiver { diff --git a/src/org/envaya/kalsms/IncomingMessageRetry.java b/src/org/envaya/kalsms/receiver/IncomingMessageRetry.java similarity index 86% rename from src/org/envaya/kalsms/IncomingMessageRetry.java rename to src/org/envaya/kalsms/receiver/IncomingMessageRetry.java index e6999a3..ad1a91b 100755 --- a/src/org/envaya/kalsms/IncomingMessageRetry.java +++ b/src/org/envaya/kalsms/receiver/IncomingMessageRetry.java @@ -1,9 +1,10 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import org.envaya.kalsms.App; public class IncomingMessageRetry extends BroadcastReceiver { diff --git a/src/org/envaya/kalsms/receiver/MMSReceiver.java b/src/org/envaya/kalsms/receiver/MMSReceiver.java new file mode 100755 index 0000000..a97e5a4 --- /dev/null +++ b/src/org/envaya/kalsms/receiver/MMSReceiver.java @@ -0,0 +1,27 @@ +/* + * Based on http://code.google.com/p/android-notifier/, copyright 2011 Rodrigo Damazio + * Licensed under the Apache License, Version 2.0 + */ + +package org.envaya.kalsms.receiver; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import org.envaya.kalsms.App; + +public class MMSReceiver extends BroadcastReceiver { + + private App app; + + @Override + public void onReceive(Context context, Intent intent) { + app = (App) context.getApplicationContext(); + + if (!app.isEnabled()) { + return; + } + + app.log("WAP Push received"); + } +} \ No newline at end of file diff --git a/src/org/envaya/kalsms/MessageStatusNotifier.java b/src/org/envaya/kalsms/receiver/MessageStatusNotifier.java similarity index 92% rename from src/org/envaya/kalsms/MessageStatusNotifier.java rename to src/org/envaya/kalsms/receiver/MessageStatusNotifier.java index 3f67703..ff31663 100755 --- a/src/org/envaya/kalsms/MessageStatusNotifier.java +++ b/src/org/envaya/kalsms/receiver/MessageStatusNotifier.java @@ -2,12 +2,12 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package org.envaya.kalsms; +package org.envaya.kalsms.receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.telephony.SmsManager; +import org.envaya.kalsms.App; public class MessageStatusNotifier extends BroadcastReceiver { diff --git a/src/org/envaya/kalsms/OutgoingMessagePoller.java b/src/org/envaya/kalsms/receiver/OutgoingMessagePoller.java similarity index 81% rename from src/org/envaya/kalsms/OutgoingMessagePoller.java rename to src/org/envaya/kalsms/receiver/OutgoingMessagePoller.java index 9bdfcd0..2f4a613 100755 --- a/src/org/envaya/kalsms/OutgoingMessagePoller.java +++ b/src/org/envaya/kalsms/receiver/OutgoingMessagePoller.java @@ -1,8 +1,9 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import org.envaya.kalsms.App; public class OutgoingMessagePoller extends BroadcastReceiver { diff --git a/src/org/envaya/kalsms/OutgoingMessageRetry.java b/src/org/envaya/kalsms/receiver/OutgoingMessageRetry.java similarity index 86% rename from src/org/envaya/kalsms/OutgoingMessageRetry.java rename to src/org/envaya/kalsms/receiver/OutgoingMessageRetry.java index 388f2dc..ed48c46 100755 --- a/src/org/envaya/kalsms/OutgoingMessageRetry.java +++ b/src/org/envaya/kalsms/receiver/OutgoingMessageRetry.java @@ -1,9 +1,10 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import org.envaya.kalsms.App; public class OutgoingMessageRetry extends BroadcastReceiver { diff --git a/src/org/envaya/kalsms/SMSReceiver.java b/src/org/envaya/kalsms/receiver/SMSReceiver.java similarity index 95% rename from src/org/envaya/kalsms/SMSReceiver.java rename to src/org/envaya/kalsms/receiver/SMSReceiver.java index 9257fe6..faf9e06 100755 --- a/src/org/envaya/kalsms/SMSReceiver.java +++ b/src/org/envaya/kalsms/receiver/SMSReceiver.java @@ -1,4 +1,4 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.receiver; import android.content.BroadcastReceiver; import android.content.Context; @@ -7,6 +7,8 @@ import android.os.Bundle; import android.telephony.SmsMessage; import java.util.ArrayList; import java.util.List; +import org.envaya.kalsms.App; +import org.envaya.kalsms.IncomingMessage; public class SMSReceiver extends BroadcastReceiver { diff --git a/src/org/envaya/kalsms/ForwarderTask.java b/src/org/envaya/kalsms/task/ForwarderTask.java similarity index 86% rename from src/org/envaya/kalsms/ForwarderTask.java rename to src/org/envaya/kalsms/task/ForwarderTask.java index 6439934..cdb473c 100755 --- a/src/org/envaya/kalsms/ForwarderTask.java +++ b/src/org/envaya/kalsms/task/ForwarderTask.java @@ -1,7 +1,10 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.task; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; +import org.envaya.kalsms.App; +import org.envaya.kalsms.IncomingMessage; +import org.envaya.kalsms.OutgoingMessage; public class ForwarderTask extends HttpTask { diff --git a/src/org/envaya/kalsms/HttpTask.java b/src/org/envaya/kalsms/task/HttpTask.java similarity index 97% rename from src/org/envaya/kalsms/HttpTask.java rename to src/org/envaya/kalsms/task/HttpTask.java index c8bc9df..c922c54 100755 --- a/src/org/envaya/kalsms/HttpTask.java +++ b/src/org/envaya/kalsms/task/HttpTask.java @@ -2,7 +2,7 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package org.envaya.kalsms; +package org.envaya.kalsms.task; import android.os.AsyncTask; import java.io.IOException; @@ -27,6 +27,9 @@ import org.apache.http.message.BasicNameValuePair; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; +import org.envaya.kalsms.App; +import org.envaya.kalsms.Base64Coder; +import org.envaya.kalsms.OutgoingMessage; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; diff --git a/src/org/envaya/kalsms/PollerTask.java b/src/org/envaya/kalsms/task/PollerTask.java similarity index 76% rename from src/org/envaya/kalsms/PollerTask.java rename to src/org/envaya/kalsms/task/PollerTask.java index b7a1526..611161d 100755 --- a/src/org/envaya/kalsms/PollerTask.java +++ b/src/org/envaya/kalsms/task/PollerTask.java @@ -1,8 +1,11 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.task; +import org.envaya.kalsms.task.HttpTask; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; +import org.envaya.kalsms.App; +import org.envaya.kalsms.OutgoingMessage; public class PollerTask extends HttpTask { diff --git a/src/org/envaya/kalsms/CheckableRelativeLayout.java b/src/org/envaya/kalsms/ui/CheckableRelativeLayout.java similarity index 98% rename from src/org/envaya/kalsms/CheckableRelativeLayout.java rename to src/org/envaya/kalsms/ui/CheckableRelativeLayout.java index 17f176e..4c5a318 100755 --- a/src/org/envaya/kalsms/CheckableRelativeLayout.java +++ b/src/org/envaya/kalsms/ui/CheckableRelativeLayout.java @@ -1,4 +1,4 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.ui; // from http://www.marvinlabs.com/2010/10/custom-listview-ability-check-items/ // package fr.marvinlabs.widget; diff --git a/src/org/envaya/kalsms/ForwardInbox.java b/src/org/envaya/kalsms/ui/ForwardInbox.java similarity index 94% rename from src/org/envaya/kalsms/ForwardInbox.java rename to src/org/envaya/kalsms/ui/ForwardInbox.java index 83f2906..b9d96af 100755 --- a/src/org/envaya/kalsms/ForwardInbox.java +++ b/src/org/envaya/kalsms/ui/ForwardInbox.java @@ -1,5 +1,5 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.ui; import android.app.ListActivity; import android.database.Cursor; @@ -9,6 +9,9 @@ import android.util.SparseBooleanArray; import android.view.View; import android.widget.ListView; import android.widget.SimpleCursorAdapter; +import org.envaya.kalsms.App; +import org.envaya.kalsms.IncomingMessage; +import org.envaya.kalsms.R; public class ForwardInbox extends ListActivity { diff --git a/src/org/envaya/kalsms/Help.java b/src/org/envaya/kalsms/ui/Help.java similarity index 96% rename from src/org/envaya/kalsms/Help.java rename to src/org/envaya/kalsms/ui/Help.java index 1e67c8e..a0336b1 100755 --- a/src/org/envaya/kalsms/Help.java +++ b/src/org/envaya/kalsms/ui/Help.java @@ -2,14 +2,14 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package org.envaya.kalsms; +package org.envaya.kalsms.ui; import android.app.Activity; -import android.content.Intent; import android.os.Bundle; import android.text.Html; import android.view.Menu; import android.widget.TextView; +import org.envaya.kalsms.R; /** * diff --git a/src/org/envaya/kalsms/InertCheckBox.java b/src/org/envaya/kalsms/ui/InertCheckBox.java similarity index 98% rename from src/org/envaya/kalsms/InertCheckBox.java rename to src/org/envaya/kalsms/ui/InertCheckBox.java index 4adc618..bcb31eb 100755 --- a/src/org/envaya/kalsms/InertCheckBox.java +++ b/src/org/envaya/kalsms/ui/InertCheckBox.java @@ -1,4 +1,4 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.ui; // from http://www.marvinlabs.com/2010/10/custom-listview-ability-check-items/ // package fr.marvinlabs.widget; diff --git a/src/org/envaya/kalsms/Main.java b/src/org/envaya/kalsms/ui/Main.java similarity index 94% rename from src/org/envaya/kalsms/Main.java rename to src/org/envaya/kalsms/ui/Main.java index e7dc6a1..da3c1e7 100755 --- a/src/org/envaya/kalsms/Main.java +++ b/src/org/envaya/kalsms/ui/Main.java @@ -1,5 +1,6 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.ui; +import org.envaya.kalsms.task.HttpTask; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; @@ -17,6 +18,8 @@ import android.widget.ScrollView; import android.widget.TextView; import org.apache.http.HttpResponse; import org.apache.http.message.BasicNameValuePair; +import org.envaya.kalsms.App; +import org.envaya.kalsms.R; public class Main extends Activity { diff --git a/src/org/envaya/kalsms/Prefs.java b/src/org/envaya/kalsms/ui/Prefs.java similarity index 97% rename from src/org/envaya/kalsms/Prefs.java rename to src/org/envaya/kalsms/ui/Prefs.java index 130c175..cd88366 100755 --- a/src/org/envaya/kalsms/Prefs.java +++ b/src/org/envaya/kalsms/ui/Prefs.java @@ -1,6 +1,5 @@ -package org.envaya.kalsms; +package org.envaya.kalsms.ui; -import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Bundle; @@ -10,6 +9,8 @@ import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceScreen; import android.view.Menu; +import org.envaya.kalsms.App; +import org.envaya.kalsms.R; public class Prefs extends PreferenceActivity implements OnSharedPreferenceChangeListener {