Skip to content
Snippets Groups Projects
Commit 2046ed0c authored by akwizgran's avatar akwizgran
Browse files

Merged Android invitation UI from add_contact repo.

parent 2eb943ee
No related branches found
No related tags found
No related merge requests found
Showing
with 229 additions and 10 deletions
...@@ -3,11 +3,23 @@ ...@@ -3,11 +3,23 @@
package="net.sf.briar" package="net.sf.briar"
android:versionCode="1" android:versionCode="1"
android:versionName="1.0" > android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16" /> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application android:label="@string/app_name" > <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<service android:name=".HelloWorldService" android:exported="false" >
<intent-filter>
<action android:name=".HelloWorldService" />
</intent-filter>
</service>
<activity <activity
android:name=".HelloWorldActivity" android:name=".HelloWorldActivity"
android:label="@string/app_name" > android:label="@string/app_name" >
...@@ -16,10 +28,37 @@ ...@@ -16,10 +28,37 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<service android:name=".HelloWorldService" android:exported="false" > <activity
<intent-filter> android:name=".android.invitation.NetworkSetupActivity"
<action android:name="net.sf.briar.HelloWorldService" /> android:label="@string/title" >
</intent-filter> </activity>
</service> <activity
android:name=".android.invitation.InvitationCodeActivity"
android:label="@string/title" >
</activity>
<activity
android:name=".android.invitation.ConnectionActivity"
android:label="@string/title" >
</activity>
<activity
android:name=".android.invitation.ConnectionFailedActivity"
android:label="@string/title" >
</activity>
<activity
android:name=".android.invitation.ConfirmationCodeActivity"
android:label="@string/title" >
</activity>
<activity
android:name=".android.invitation.WaitForContactActivity"
android:label="@string/title" >
</activity>
<activity
android:name=".android.invitation.CodesDoNotMatchActivity"
android:label="@string/title" >
</activity>
<activity
android:name=".android.invitation.ContactAddedActivity"
android:label="@string/title" >
</activity>
</application> </application>
</manifest> </manifest>
res/drawable-hdpi/ic_launcher.png

2.31 KiB

res/drawable-ldpi/ic_launcher.png

1.25 KiB

res/drawable-ldpi/iconic_check_alt_green.png

499 B

res/drawable-ldpi/iconic_x_alt_red.png

552 B

res/drawable-mdpi/ic_launcher.png

1.55 KiB

res/drawable-xhdpi/ic_launcher.png

3.12 KiB

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/add_contact_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/codes_do_not_match_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/connection_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" />
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/connection_failed_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/connection_succeeded_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" />
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_added_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/invitation_code_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/network_setup_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" />
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/test_bt_screen_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Testing Bluetooth actions"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show paired devices info"
android:onClick="showBtPairedDevicesButtonClicked" />
<Button
android:id="@+id/test_bt_conn_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Connect bluetooh"
android:onClick="testBtConnButtonClicked" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/test_bt_sendData_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="testBtSendDataButtonClicked"
android:text="Send data" />
<Button
android:id="@+id/test_bt_recvData_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="testBtReceiveDataButtonClicked"
android:text="Recive data" />
</LinearLayout>
<ScrollView
android:id="@+id/test_bt_log_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/test_bt_log_console_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bluetooth actions log" />
<TextView
android:id="@+id/test_bt_log_console_msgs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="actions log..." />
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/wait_for_contact_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" />
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Briar</string> <string name="app_name">Briar</string>
<string name="menu_settings">Settings</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="turn_on_wifi_button">Turn on Wi-Fi</string>
<string name="wifi_disconnected">Wi-Fi is DISCONNECTED.</string>
<string name="connect_to_wifi_button">Connect to Wi-Fi</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="turn_on_bluetooth_button">Turn on Bluetooth</string>
<string name="bluetooth_not_discoverable">Bluetooth is NOT DISCOVERABLE.</string>
<string name="make_bluetooth_discoverable_button">Make Bluetooth 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> </resources>
package net.sf.briar; package net.sf.briar;
import net.sf.briar.android.invitation.NetworkSetupActivity;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
public class HelloWorldActivity extends Activity { public class HelloWorldActivity extends Activity implements OnClickListener {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
TextView text = new TextView(this); setContentView(R.layout.activity_add_contact);
text.setText("Hello world"); LinearLayout layout = (LinearLayout) findViewById(
setContentView(text); R.id.add_contact_container);
TextView welcome = new TextView(this);
welcome.setText(R.string.welcome);
layout.addView(welcome);
Button addContact = new Button(this);
addContact.setText(R.string.add_contact_button);
addContact.setOnClickListener(this);
layout.addView(addContact);
TextView faceToFace = new TextView(this);
faceToFace.setText(R.string.face_to_face);
layout.addView(faceToFace);
Intent intent = new Intent("net.sf.briar.HelloWorldService"); Intent intent = new Intent("net.sf.briar.HelloWorldService");
startService(intent); startService(intent);
} }
public void onClick(View view) {
startActivity(new Intent(this, NetworkSetupActivity.class));
finish();
}
} }
package net.sf.briar.android.invitation;
interface BluetoothStateListener {
void bluetoothStateChanged(boolean enabled);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment