diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 92245565b49300ab67d78d36f440443392995e68..a48b0ef0d0d36d789285d5f14406b175e693eb67 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -16,13 +16,15 @@ android:theme="@android:style/Theme.Light" android:icon="@drawable/ic_launcher" android:label="@string/app_name" > - <service android:name=".HelloWorldService" android:exported="false" > + <service + android:name=".android.helloworld.HelloWorldService" + android:exported="false" > <intent-filter> - <action android:name=".HelloWorldService" /> + <action android:name="net.sf.briar.android.helloworld.HelloWorldService" /> </intent-filter> </service> <activity - android:name=".HelloWorldActivity" + android:name=".android.helloworld.HelloWorldActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> @@ -31,35 +33,35 @@ </activity> <activity android:name=".android.invitation.NetworkSetupActivity" - android:label="@string/title" > + android:label="@string/add_a_contact" > </activity> <activity android:name=".android.invitation.InvitationCodeActivity" - android:label="@string/title" > + android:label="@string/add_a_contact" > </activity> <activity android:name=".android.invitation.ConnectionActivity" - android:label="@string/title" > + android:label="@string/add_a_contact" > </activity> <activity android:name=".android.invitation.ConnectionFailedActivity" - android:label="@string/title" > + android:label="@string/add_a_contact" > </activity> <activity android:name=".android.invitation.ConfirmationCodeActivity" - android:label="@string/title" > + android:label="@string/add_a_contact" > </activity> <activity android:name=".android.invitation.WaitForContactActivity" - android:label="@string/title" > + android:label="@string/add_a_contact" > </activity> <activity android:name=".android.invitation.CodesDoNotMatchActivity" - android:label="@string/title" > + android:label="@string/add_a_contact" > </activity> <activity android:name=".android.invitation.ContactAddedActivity" - android:label="@string/title" > + android:label="@string/add_a_contact" > </activity> </application> </manifest> diff --git a/res/values/roboguice.xml b/res/values/roboguice.xml index c7d58a7a3ddf0e68b2e921fd4fa59790a83c9254..82fd88cbc514fa058a0616e8a23984153a80e614 100644 --- a/res/values/roboguice.xml +++ b/res/values/roboguice.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<resources> +<resources> <string-array name="roboguice_modules"> - <item>net.sf.briar.HelloWorldModule</item> <item>net.sf.briar.android.AndroidModule</item> + <item>net.sf.briar.android.helloworld.HelloWorldModule</item> <item>net.sf.briar.android.invitation.AndroidInvitationModule</item> <item>net.sf.briar.clock.ClockModule</item> <item>net.sf.briar.crypto.CryptoModule</item> diff --git a/res/values/strings.xml b/res/values/strings.xml index 58c646fb87d2fa15e44df5b3b917bf0924005fa2..351de82417bf3208b89cf3f29ea3b7fd283d6b6d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,35 +1,35 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="app_name">Briar</string> - <string name="title">Add a Contact</string> - <string name="welcome">Welcome to Briar! Add a contact to get started.</string> - <string name="add_contact_button">Add a contact</string> - <string name="face_to_face">For security reasons you must be face to face with someone to add them as a contact.</string> - <string name="same_network">Briar can add contacts via Wi-Fi or Bluetooth. To use Wi-Fi you must both be connected to the same network.</string> - <string name="wifi_not_available">Wi-Fi is not available on this device</string> - <string name="wifi_disabled">Wi-Fi is OFF</string> - <string name="wifi_disconnected">Wi-Fi is DISCONNECTED</string> - <string name="wifi_connected">Wi-Fi is CONNECTED to %1$s</string> - <string name="bluetooth_not_available">Bluetooth is not available on this device</string> - <string name="bluetooth_disabled">Bluetooth is OFF</string> - <string name="bluetooth_not_discoverable">Bluetooth is NOT DISCOVERABLE</string> - <string name="bluetooth_enabled">Bluetooth is ON</string> - <string name="continue_button">Continue</string> - <string name="your_invitation_code">Your invitation code is</string> - <string name="enter_invitation_code">Please enter your contact\'s invitation code:</string> - <string name="connecting_wifi">Connecting via %1$s\u2026</string> - <string name="connecting_bluetooth">Connecting via Bluetooth\u2026</string> - <string name="connection_failed">Connection failed</string> - <string name="check_same_network">Please check that you are both using the same network.</string> - <string name="try_again_button">Try again</string> - <string name="connected_to_contact">Connected to contact</string> - <string name="your_confirmation_code">Your confirmation code is</string> - <string name="enter_confirmation_code">Please enter your contact\'s confirmation code:</string> - <string name="waiting_for_contact">Waiting for contact\u2026</string> - <string name="codes_do_not_match">Codes do not match</string> - <string name="interfering">This could mean that someone is trying to interfere with your connection.</string> - <string name="contact_added">Contact added</string> - <string name="enter_nickname">Please enter a nickname for this contact:</string> - <string name="add_another_contact_button">Add another contact</string> - <string name="done_button">Done</string> + <string name="app_name">Briar</string> + <string name="welcome">Welcome to Briar! Add a contact to get started.</string> + <string name="face_to_face">For security reasons you must be face to face with someone to add them as a contact.</string> + <string name="add_contact_button">Add a contact</string> + <string name="add_a_contact">Add a Contact</string> + <string name="same_network">Briar can add contacts via Wi-Fi or Bluetooth. To use Wi-Fi you must both be connected to the same network.</string> + <string name="wifi_not_available">Wi-Fi is not available on this device</string> + <string name="wifi_disabled">Wi-Fi is OFF</string> + <string name="wifi_disconnected">Wi-Fi is DISCONNECTED</string> + <string name="wifi_connected">Wi-Fi is CONNECTED to %1$s</string> + <string name="bluetooth_not_available">Bluetooth is not available on this device</string> + <string name="bluetooth_disabled">Bluetooth is OFF</string> + <string name="bluetooth_not_discoverable">Bluetooth is NOT DISCOVERABLE</string> + <string name="bluetooth_enabled">Bluetooth is ON</string> + <string name="continue_button">Continue</string> + <string name="your_invitation_code">Your invitation code is</string> + <string name="enter_invitation_code">Please enter your contact\'s invitation code:</string> + <string name="connecting_wifi">Connecting via %1$s\u2026</string> + <string name="connecting_bluetooth">Connecting via Bluetooth\u2026</string> + <string name="connection_failed">Connection failed</string> + <string name="check_same_network">Please check that you are both using the same network.</string> + <string name="try_again_button">Try again</string> + <string name="connected_to_contact">Connected to contact</string> + <string name="your_confirmation_code">Your confirmation code is</string> + <string name="enter_confirmation_code">Please enter your contact\'s confirmation code:</string> + <string name="waiting_for_contact">Waiting for contact\u2026</string> + <string name="codes_do_not_match">Codes do not match</string> + <string name="interfering">This could mean that someone is trying to interfere with your connection.</string> + <string name="contact_added">Contact added</string> + <string name="enter_nickname">Please enter a nickname for this contact:</string> + <string name="add_another_contact_button">Add another contact</string> + <string name="done_button">Done</string> </resources> diff --git a/src/build.xml b/src/build.xml index b58556445452febe7db00ba1fa09bf152c0534f1..2979431edaebba402602bc06ebaab82ab02ba92d 100644 --- a/src/build.xml +++ b/src/build.xml @@ -17,8 +17,8 @@ includeantruntime='false' debug='off'> <src path='.'/> <include name='net/sf/briar/**'/> - <exclude name='net/sf/briar/*.java'/> - <exclude name='net/sf/briar/android/invitation/*.java'/> + <exclude name='net/sf/briar/android/helloworld/**'/> + <exclude name='net/sf/briar/android/invitation/**'/> <classpath> <fileset refid='prototype-jars'/> <path refid='android-jar'/> diff --git a/src/net/sf/briar/HelloWorldActivity.java b/src/net/sf/briar/android/helloworld/HelloWorldActivity.java similarity index 74% rename from src/net/sf/briar/HelloWorldActivity.java rename to src/net/sf/briar/android/helloworld/HelloWorldActivity.java index 3b0355a311830d90b9e3bc7df7f226abe2901cdb..794495d24dd85262ffd52dde1e1eb6ea7c2773a9 100644 --- a/src/net/sf/briar/HelloWorldActivity.java +++ b/src/net/sf/briar/android/helloworld/HelloWorldActivity.java @@ -1,11 +1,16 @@ -package net.sf.briar; +package net.sf.briar.android.helloworld; import static android.view.Gravity.CENTER_HORIZONTAL; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.widget.LinearLayout.VERTICAL; +import static java.util.logging.Level.INFO; + +import java.util.logging.Logger; + +import net.sf.briar.R; import net.sf.briar.android.invitation.NetworkSetupActivity; -import android.app.Activity; +import roboguice.activity.RoboActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; @@ -15,11 +20,16 @@ import android.widget.LinearLayout; import android.widget.RelativeLayout.LayoutParams; import android.widget.TextView; -public class HelloWorldActivity extends Activity implements OnClickListener { +public class HelloWorldActivity extends RoboActivity +implements OnClickListener { + + private static final Logger LOG = + Logger.getLogger(HelloWorldActivity.class.getName()); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + if(LOG.isLoggable(INFO)) LOG.info("Created"); LinearLayout layout = new LinearLayout(this); layout.setLayoutParams(new LayoutParams(MATCH_PARENT, MATCH_PARENT)); layout.setOrientation(VERTICAL); @@ -46,7 +56,13 @@ public class HelloWorldActivity extends Activity implements OnClickListener { setContentView(layout); - startService(new Intent("net.sf.briar.HelloWorldService")); + startService(new Intent(HelloWorldService.class.getName())); + } + + @Override + public void onDestroy() { + super.onDestroy(); + if(LOG.isLoggable(INFO)) LOG.info("Destroyed"); } public void onClick(View view) { diff --git a/src/net/sf/briar/HelloWorldModule.java b/src/net/sf/briar/android/helloworld/HelloWorldModule.java similarity index 96% rename from src/net/sf/briar/HelloWorldModule.java rename to src/net/sf/briar/android/helloworld/HelloWorldModule.java index 5fe4fad758d86eaab80c6500223b50a2e1cdbdf7..c96fec94f1f49e7e8eae76670feb7ab475c55774 100644 --- a/src/net/sf/briar/HelloWorldModule.java +++ b/src/net/sf/briar/android/helloworld/HelloWorldModule.java @@ -1,4 +1,4 @@ -package net.sf.briar; +package net.sf.briar.android.helloworld; import static android.content.Context.MODE_PRIVATE; diff --git a/src/net/sf/briar/HelloWorldService.java b/src/net/sf/briar/android/helloworld/HelloWorldService.java similarity index 84% rename from src/net/sf/briar/HelloWorldService.java rename to src/net/sf/briar/android/helloworld/HelloWorldService.java index ef2dec27c8e8fb2391ea8cbba6698aa860cd0fad..eeb74c315147bc37ccf5f8234a9813db8c32d510 100644 --- a/src/net/sf/briar/HelloWorldService.java +++ b/src/net/sf/briar/android/helloworld/HelloWorldService.java @@ -1,4 +1,4 @@ -package net.sf.briar; +package net.sf.briar.android.helloworld; import static java.util.logging.Level.INFO; import static java.util.logging.Level.WARNING; @@ -10,13 +10,13 @@ import net.sf.briar.api.crypto.KeyManager; import net.sf.briar.api.db.DatabaseComponent; import net.sf.briar.api.db.DbException; import net.sf.briar.api.plugins.PluginManager; -import android.app.Service; +import roboguice.service.RoboService; import android.content.Intent; import android.os.IBinder; import com.google.inject.Inject; -public class HelloWorldService extends Service implements Runnable { +public class HelloWorldService extends RoboService implements Runnable { private static final Logger LOG = Logger.getLogger(HelloWorldService.class.getName()); @@ -27,6 +27,8 @@ public class HelloWorldService extends Service implements Runnable { @Override public void onCreate() { + super.onCreate(); + if(LOG.isLoggable(INFO)) LOG.info("Created"); Thread t = new Thread(this); t.setDaemon(false); t.start(); @@ -42,6 +44,12 @@ public class HelloWorldService extends Service implements Runnable { return null; } + @Override + public void onDestroy() { + super.onDestroy(); + if(LOG.isLoggable(INFO)) LOG.info("Destroyed"); + } + public void run() { try { // Start... @@ -71,5 +79,6 @@ public class HelloWorldService extends Service implements Runnable { } catch(IOException e) { if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); } + stopSelf(); } }