From f1af27554d659a81fb8b21ac1cb309eaba5594f5 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Sat, 21 Dec 2013 23:55:22 +0000
Subject: [PATCH] Removed share button, which rarely worked, and two compose
 buttons.

---
 .../res/drawable-hdpi/social_share.png        | Bin 1695 -> 0 bytes
 .../res/drawable-mdpi/social_share.png        | Bin 1394 -> 0 bytes
 .../res/drawable-xhdpi/social_share.png       | Bin 1989 -> 0 bytes
 briar-android/res/values/strings.xml          |   6 +-
 .../android/contact/ContactListActivity.java  |  38 +----
 .../android/groups/GroupListActivity.java     |  27 +---
 .../android/groups/GroupSpinnerAdapter.java   |  76 ----------
 .../briar/android/groups/NoGroupsDialog.java  |  43 ------
 .../groups/WriteGroupPostActivity.java        | 142 +++++-------------
 9 files changed, 41 insertions(+), 291 deletions(-)
 delete mode 100644 briar-android/res/drawable-hdpi/social_share.png
 delete mode 100644 briar-android/res/drawable-mdpi/social_share.png
 delete mode 100644 briar-android/res/drawable-xhdpi/social_share.png
 delete mode 100644 briar-android/src/net/sf/briar/android/groups/GroupSpinnerAdapter.java
 delete mode 100644 briar-android/src/net/sf/briar/android/groups/NoGroupsDialog.java

diff --git a/briar-android/res/drawable-hdpi/social_share.png b/briar-android/res/drawable-hdpi/social_share.png
deleted file mode 100644
index 47ae186749df92bbbe77f860ce657d3edce27765..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 1695
zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC$r9IylHmNblJdl&R0hYC{G?O`
z&)mfH)S%SFl*+=BsWuD@%qp275hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y
zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP
zs8ErclUHn2VXFi-*9yo63F|8<fR&VF+bTgE72zA8;GAESs$i;Tpqp%9W~g9hqGxDg
zU}<8hqhMrUXrOOsq;FuZY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t6Q;W~!$
z1CL#`yq#IzJkt@cou^s+fq$l->s-H-*fl4^8aiiiR)6q*<YRL*Ytbhi)oUM@<T1_L
z%%Udx*Kyx-fgLB--Cot*@IImE?6O|%hb}gMWhzeAZepCn*j%J8;MT=9b7f}1&BYUa
zt4ucOKFE>i)p=IF^YyN<mDjvxaA_~>iHco4#qz<PM+~1BY>H>@thHg@adu9v^+S{5
z%Xg}ax0)5#3xD>RTR460yT|uFY`QG=a{1hI*Nj?Ul`hEqXmLU3L!8F*=}w8JMlUag
zA5^`!>*U+pT<-jZ?Vf__FIu*~JhG{CeS<XPzwIZdzP@<TD`dz25IJo}!CRaL%slt@
z-O+lbp>Te)ON^n}P3`;=QG>)E@pqO*xE1fZmAUeBeq>m#v&8dz8O#4l82{04kpA_%
zLE?yFL67?WWxpE_FNoctR(AZu&(4*v{QlU_IRQ$N9u3bvx;HQ~DDj*tE_ssV52`Xe
MUHx3vIVCg!0FRcDBme*a

diff --git a/briar-android/res/drawable-mdpi/social_share.png b/briar-android/res/drawable-mdpi/social_share.png
deleted file mode 100644
index 8aa52bc7d8a74739dc5e0ad9c35a006bdcbda182..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 1394
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz$r9IylHmNblJdl&R0hYC{G?O`
z&)mfH)S%SFl*+=BsWuD@%qp275hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y
zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP
zs8ErclUHn2VXFi-*9yo63F|8<fR&VF+bTgE72zA8;GAESs$i;Tpqp%9W~g9hqGxDg
zU}<8hqhMrUXrOOsq;FuZYiM9)YHnp<r~m~@K--E^(yW49+@N*=dA3R!B_#z``ugSN
z<$C4Ddih1^`i7R4mih)p`bI{&Koz>hm3bwJ6}oxF$}kgLQj3#|G7CyF^YauyCMG83
zmzLNn0bL65LT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/briar-android/res/drawable-xhdpi/social_share.png
deleted file mode 100644
index cdafd8abca1912ff47f812c38fd29994da1d7867..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 1989
zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=k|nMYCBgY=CFO}lsSJ)O`AMk?
zp1FzXsX?iUDV2pMQ*9U+m{l@EB1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+*
zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn
zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxKsVXI%uvD1M9<K~
zz|zE0N5ROz&_LhNNZ-I**U-Sq)ZEIzPyq^*fVLH-q*(>IxIyg#@@$ndN=gc>^!3Zj
z%k|2Q_413-^$jg8E%gnI^o@*kfhu&1EAvVcD|GXUm0>2hq!uR^WfqiV=I1GZOiWD5
zFD<cE0=g99h1>$Tv3bSNU;+l1ennz|zM-B0$V)JVzP|XC=H|jx7ncO3BHWAB;Np<V
zf>iyW)Z+ZoqGVvir744~DzI`cN=+=uFAB-e&w+(vKt_H^esM;Afr4|esh**NZ(?$0
z9!LbN!`Ii!Gq1QLF)umQ)5TT^Xog;9W{Q=mqmiqtfw7yZlYxt&p{t>#iJ_&diIcOV
zo2j9>iIX8ruS<S%X>Mv>2~2MaT(5}%PQ9SSkXrz>*(J3ovn(~mttdZN0qkk3Ox$j9
z!D${;ZwgMg7`x)ss}FRHJ}7FDq8cUyOg|tdJmCU4@T8xb2Tbopz=SQH<8*_8fyLa@
z#WAGf)|=TUvqc<5j%BAkN{LA_a0^_#!@=gr4tLcZ%6b`mi!>^@=dpf#bkhF7<cbe!
zE7%2DK0cAUzJlHK;0_m8R`W+qh6g1!pG&#*e&YItlIq5>k27{z#eQf`3A!8nes%cO
z_j}j1=$sBx-r35;hzvJvTeV8dzen7Mb+RMlgoE3g)-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3d)p`(<kR
z`<fSLZO9P|e0Toek(pcdJ~*3YOh2eR>$<AM{2xlPdZE8cPpj-bAkI{x{e8LfoY{%<
z<5@BSe?4bb@_PJq#dX$<G(W*>8;+mTuTgZcc77}oYaQKv@kcl?na|qusqVxBjVXzD
zkH7epUh<7WxbIY#;qn=8LM~spvUn4xo;c@{eJ|6})VBDECCN32X0gak+cw*!&HjMO
t*XM;l=luJq_@lkkp#cFW-mc>|U|2pqb=lf2<{6-h)zj6_Wt~$(696}+7_k5V

diff --git a/briar-android/res/values/strings.xml b/briar-android/res/values/strings.xml
index 7dabb29c79..50b17cc298 100644
--- a/briar-android/res/values/strings.xml
+++ b/briar-android/res/values/strings.xml
@@ -17,7 +17,6 @@
 	<string name="quit_button">Quit</string>
 	<string name="new_identity_item">New identity\u2026</string>
 	<string name="contact_list_title">Contacts</string>
-	<string name="share_app">Share the Briar App</string>
 	<string name="contact_connected">Connected</string>
 	<string name="format_last_connected">Last connected &lt;br /&gt; %1$s</string>
 	<string name="add_contact_title">Add a Contact</string>
@@ -71,16 +70,15 @@
 	<string name="forum_visible_to_some">Share this forum with chosen contacts</string>
 	<string name="new_post_title">New Post</string>
 	<string name="new_forum_item">New forum\u2026</string>
-	<string name="manage_subscriptions_title">Manage Subscriptions</string>
+	<string name="manage_subscriptions_title">Available Forums</string>
 	<string name="no_forums_available">No forums available from contacts</string>
 	<string name="subscribed_all">Subscribed, shared with all contacts</string>
 	<string name="subscribed_some">Subscribed, shared with chosen contacts</string>
 	<string name="not_subscribed">Not subscribed</string>
 	<string name="create_nickname_item">New nickname\u2026</string>
-	<string name="new_identity_title">New Identity</string>
+	<string name="new_identity_title">New Nickname</string>
 	<string name="create_button">Create</string>
 	<string name="no_contacts">You don\'t have any contacts. Add a contact now?</string>
 	<string name="add_button">Add</string>
 	<string name="cancel_button">Cancel</string>
-	<string name="no_forums">You aren\'t subscribed to any forums. Create a forum now?</string>
 </resources>
diff --git a/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java b/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java
index e1f939324d..f1e3316e44 100644
--- a/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java
+++ b/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java
@@ -1,20 +1,14 @@
 package net.sf.briar.android.contact;
 
-import static android.content.Intent.ACTION_SEND;
-import static android.content.Intent.EXTRA_STREAM;
-import static android.view.Gravity.CENTER;
 import static android.view.Gravity.CENTER_HORIZONTAL;
 import static android.view.View.GONE;
 import static android.view.View.VISIBLE;
-import static android.widget.LinearLayout.HORIZONTAL;
 import static android.widget.LinearLayout.VERTICAL;
 import static java.util.logging.Level.INFO;
 import static java.util.logging.Level.WARNING;
 import static net.sf.briar.android.util.CommonLayoutParams.MATCH_MATCH;
-import static net.sf.briar.android.util.CommonLayoutParams.MATCH_WRAP;
 import static net.sf.briar.android.util.CommonLayoutParams.MATCH_WRAP_1;
 
-import java.io.File;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.Map;
@@ -26,7 +20,6 @@ import javax.inject.Inject;
 import net.sf.briar.R;
 import net.sf.briar.android.invitation.AddContactActivity;
 import net.sf.briar.android.util.HorizontalBorder;
-import net.sf.briar.android.util.HorizontalSpace;
 import net.sf.briar.android.util.ListLoadingProgressBar;
 import net.sf.briar.api.Contact;
 import net.sf.briar.api.ContactId;
@@ -46,7 +39,6 @@ import net.sf.briar.api.transport.ConnectionListener;
 import net.sf.briar.api.transport.ConnectionRegistry;
 import roboguice.activity.RoboActivity;
 import android.content.Intent;
-import android.net.Uri;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View.OnClickListener;
@@ -64,7 +56,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
 	private ContactListAdapter adapter = null;
 	private ListView list = null;
 	private ListLoadingProgressBar loading = null;
-	private ImageButton addContactButton = null, shareButton = null;
+	private ImageButton addContactButton = null;
 
 	// Fields that are accessed from background threads must be volatile
 	@Inject private volatile DatabaseComponent db;
@@ -94,26 +86,11 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
 
 		layout.addView(new HorizontalBorder(this));
 
-		LinearLayout footer = new LinearLayout(this);
-		footer.setLayoutParams(MATCH_WRAP);
-		footer.setOrientation(HORIZONTAL);
-		footer.setGravity(CENTER);
-		footer.addView(new HorizontalSpace(this));
-
 		addContactButton = new ImageButton(this);
 		addContactButton.setBackgroundResource(0);
 		addContactButton.setImageResource(R.drawable.social_add_person);
 		addContactButton.setOnClickListener(this);
-		footer.addView(addContactButton);
-		footer.addView(new HorizontalSpace(this));
-
-		shareButton = new ImageButton(this);
-		shareButton.setBackgroundResource(0);
-		shareButton.setImageResource(R.drawable.social_share);
-		shareButton.setOnClickListener(this);
-		footer.addView(shareButton);
-		footer.addView(new HorizontalSpace(this));
-		layout.addView(footer);
+		layout.addView(addContactButton);
 
 		setContentView(layout);
 	}
@@ -218,16 +195,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
 	}
 
 	public void onClick(View view) {
-		if(view == addContactButton) {
-			startActivity(new Intent(this, AddContactActivity.class));
-		} else if(view == shareButton) {
-			String apkPath = getPackageCodePath();
-			Intent i = new Intent(ACTION_SEND);
-			i.setType("application/*");
-			i.putExtra(EXTRA_STREAM, Uri.fromFile(new File(apkPath)));
-			String shareApp = getResources().getString(R.string.share_app);
-			startActivity(Intent.createChooser(i, shareApp));
-		}
+		startActivity(new Intent(this, AddContactActivity.class));
 	}
 
 	public void eventOccurred(DatabaseEvent e) {
diff --git a/briar-android/src/net/sf/briar/android/groups/GroupListActivity.java b/briar-android/src/net/sf/briar/android/groups/GroupListActivity.java
index 894e67c687..0689eba6d0 100644
--- a/briar-android/src/net/sf/briar/android/groups/GroupListActivity.java
+++ b/briar-android/src/net/sf/briar/android/groups/GroupListActivity.java
@@ -54,8 +54,7 @@ import android.widget.LinearLayout;
 import android.widget.ListView;
 
 public class GroupListActivity extends RoboFragmentActivity
-implements DatabaseListener, OnClickListener, NoGroupsDialog.Listener,
-OnItemClickListener {
+implements DatabaseListener, OnClickListener, OnItemClickListener {
 
 	private static final Logger LOG =
 			Logger.getLogger(GroupListActivity.class.getName());
@@ -66,8 +65,7 @@ OnItemClickListener {
 	private GroupListAdapter adapter = null;
 	private ListView list = null;
 	private ListLoadingProgressBar loading = null;
-	private ImageButton newGroupButton = null, composeButton = null;
-	private ImageButton manageGroupsButton = null;
+	private ImageButton newGroupButton = null, manageGroupsButton = null;
 
 	// Fields that are accessed from background threads must be volatile
 	@Inject private volatile DatabaseComponent db;
@@ -110,13 +108,6 @@ OnItemClickListener {
 		footer.addView(newGroupButton);
 		footer.addView(new HorizontalSpace(this));
 
-		composeButton = new ImageButton(this);
-		composeButton.setBackgroundResource(0);
-		composeButton.setImageResource(R.drawable.content_new_email);
-		composeButton.setOnClickListener(this);
-		footer.addView(composeButton);
-		footer.addView(new HorizontalSpace(this));
-
 		manageGroupsButton = new ImageButton(this);
 		manageGroupsButton.setBackgroundResource(0);
 		manageGroupsButton.setImageResource(R.drawable.action_settings);
@@ -343,25 +334,11 @@ OnItemClickListener {
 	public void onClick(View view) {
 		if(view == newGroupButton) {
 			startActivity(new Intent(this, CreateGroupActivity.class));
-		} else if(view == composeButton) {
-			if(adapter.isEmpty()) {
-				NoGroupsDialog dialog = new NoGroupsDialog();
-				dialog.setListener(this);
-				dialog.show(getSupportFragmentManager(), "NoGroupsDialog");
-			} else {
-				startActivity(new Intent(this, WriteGroupPostActivity.class));
-			}
 		} else if(view == manageGroupsButton) {
 			startActivity(new Intent(this, ManageGroupsActivity.class));
 		}
 	}
 
-	public void groupCreationSelected() {
-		startActivity(new Intent(this, CreateGroupActivity.class));
-	}
-
-	public void groupCreationCancelled() {}
-
 	public void onItemClick(AdapterView<?> parent, View view, int position,
 			long id) {
 		GroupListItem item = adapter.getItem(position);
diff --git a/briar-android/src/net/sf/briar/android/groups/GroupSpinnerAdapter.java b/briar-android/src/net/sf/briar/android/groups/GroupSpinnerAdapter.java
deleted file mode 100644
index 73cbbd7151..0000000000
--- a/briar-android/src/net/sf/briar/android/groups/GroupSpinnerAdapter.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package net.sf.briar.android.groups;
-
-import static net.sf.briar.android.groups.GroupItem.NEW;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import net.sf.briar.R;
-import android.content.Context;
-import android.content.res.Resources;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.SpinnerAdapter;
-import android.widget.TextView;
-
-class GroupSpinnerAdapter extends BaseAdapter implements SpinnerAdapter {
-
-	private final Context ctx;
-	private final List<GroupItem> list = new ArrayList<GroupItem>();
-
-	GroupSpinnerAdapter(Context ctx) {
-		this.ctx = ctx;
-	}
-
-	public void add(GroupItem item) {
-		list.add(item);
-	}
-
-	public void clear() {
-		list.clear();
-	}
-
-	public int getCount() {
-		return list.isEmpty() ? 0 : list.size() + 1;
-	}
-
-	@Override
-	public View getDropDownView(int position, View convertView,
-			ViewGroup parent) {
-		return getView(position, convertView, parent);
-	}
-
-	public GroupItem getItem(int position) {
-		if(position == list.size()) return NEW;
-		return list.get(position);
-	}
-
-	public long getItemId(int position) {
-		return android.R.layout.simple_spinner_item;
-	}
-
-	public View getView(int position, View convertView, ViewGroup parent) {
-		TextView name = new TextView(ctx);
-		name.setTextSize(18);
-		name.setMaxLines(1);
-		Resources res = ctx.getResources();
-		int pad = res.getInteger(R.integer.spinner_padding);
-		name.setPadding(pad, pad, pad, pad);
-		GroupItem item = getItem(position);
-		if(item == NEW) name.setText(R.string.new_forum_item);
-		else name.setText(item.getGroup().getName());
-		return name;
-	}
-
-	@Override
-	public boolean isEmpty() {
-		return list.isEmpty();
-	}
-
-	public void sort(Comparator<GroupItem> comparator) {
-		Collections.sort(list, comparator);
-	}
-}
diff --git a/briar-android/src/net/sf/briar/android/groups/NoGroupsDialog.java b/briar-android/src/net/sf/briar/android/groups/NoGroupsDialog.java
deleted file mode 100644
index 4b51bd38c8..0000000000
--- a/briar-android/src/net/sf/briar/android/groups/NoGroupsDialog.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.sf.briar.android.groups;
-
-import net.sf.briar.R;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.support.v4.app.DialogFragment;
-
-public class NoGroupsDialog extends DialogFragment {
-
-	private Listener listener = null;
-
-	void setListener(Listener listener) {
-		this.listener = listener;
-	}
-
-	@Override
-	public Dialog onCreateDialog(Bundle state) {
-		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
-		builder.setMessage(R.string.no_forums);
-		builder.setPositiveButton(R.string.create_button,
-				new DialogInterface.OnClickListener() {
-			public void onClick(DialogInterface dialog, int id) {
-				listener.groupCreationSelected();
-			}
-		});
-		builder.setNegativeButton(R.string.cancel_button,
-				new DialogInterface.OnClickListener() {
-			public void onClick(DialogInterface dialog, int id) {
-				listener.groupCreationCancelled();
-			}
-		});
-		return builder.create();
-	}
-
-	interface Listener {
-
-		void groupCreationSelected();
-
-		void groupCreationCancelled();
-	}
-}
diff --git a/briar-android/src/net/sf/briar/android/groups/WriteGroupPostActivity.java b/briar-android/src/net/sf/briar/android/groups/WriteGroupPostActivity.java
index 14f4f7f72f..21e4860152 100644
--- a/briar-android/src/net/sf/briar/android/groups/WriteGroupPostActivity.java
+++ b/briar-android/src/net/sf/briar/android/groups/WriteGroupPostActivity.java
@@ -11,7 +11,6 @@ import static net.sf.briar.android.util.CommonLayoutParams.MATCH_WRAP;
 
 import java.io.IOException;
 import java.security.GeneralSecurityException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.concurrent.Executor;
 import java.util.logging.Logger;
@@ -35,12 +34,12 @@ import net.sf.briar.api.db.DbException;
 import net.sf.briar.api.lifecycle.LifecycleManager;
 import net.sf.briar.api.messaging.Group;
 import net.sf.briar.api.messaging.GroupId;
-import net.sf.briar.api.messaging.GroupStatus;
 import net.sf.briar.api.messaging.Message;
 import net.sf.briar.api.messaging.MessageFactory;
 import net.sf.briar.api.messaging.MessageId;
 import roboguice.activity.RoboActivity;
 import android.content.Intent;
+import android.content.res.Resources;
 import android.os.Bundle;
 import android.text.InputType;
 import android.view.View;
@@ -61,10 +60,10 @@ implements OnItemSelectedListener, OnClickListener {
 
 	@Inject private CryptoComponent crypto;
 	@Inject private MessageFactory messageFactory;
-	private LocalAuthorSpinnerAdapter fromAdapter = null;
-	private GroupSpinnerAdapter toAdapter = null;
-	private Spinner fromSpinner = null, toSpinner = null;
+	private LocalAuthorSpinnerAdapter adapter = null;
+	private Spinner spinner = null;
 	private ImageButton sendButton = null;
+	private TextView to = null;
 	private EditText content = null;
 	private AuthorId localAuthorId = null;
 	private GroupId groupId = null;
@@ -84,7 +83,9 @@ implements OnItemSelectedListener, OnClickListener {
 
 		Intent i = getIntent();
 		byte[] b = i.getByteArrayExtra("net.sf.briar.GROUP_ID");
-		if(b != null) groupId = new GroupId(b);
+		if(b == null) throw new IllegalStateException();
+		groupId = new GroupId(b);
+		
 		b = i.getByteArrayExtra("net.sf.briar.PARENT_ID");
 		if(b != null) parentId = new MessageId(b);
 		timestamp = i.getLongExtra("net.sf.briar.TIMESTAMP", -1);
@@ -92,8 +93,6 @@ implements OnItemSelectedListener, OnClickListener {
 		if(state != null) {
 			b = state.getByteArray("net.sf.briar.LOCAL_AUTHOR_ID");
 			if(b != null) localAuthorId = new AuthorId(b);
-			b = state.getByteArray("net.sf.briar.GROUP_ID");
-			if(b != null) groupId = new GroupId(b);
 		}
 
 		LinearLayout layout = new LinearLayout(this);
@@ -111,39 +110,27 @@ implements OnItemSelectedListener, OnClickListener {
 		from.setText(R.string.from);
 		header.addView(from);
 
-		fromAdapter = new LocalAuthorSpinnerAdapter(this, true);
-		fromSpinner = new Spinner(this);
-		fromSpinner.setAdapter(fromAdapter);
-		fromSpinner.setOnItemSelectedListener(this);
-		header.addView(fromSpinner);
+		adapter = new LocalAuthorSpinnerAdapter(this, true);
+		spinner = new Spinner(this);
+		spinner.setAdapter(adapter);
+		spinner.setOnItemSelectedListener(this);
+		header.addView(spinner);
 
 		header.addView(new HorizontalSpace(this));
 
 		sendButton = new ImageButton(this);
 		sendButton.setBackgroundResource(0);
 		sendButton.setImageResource(R.drawable.social_send_now);
-		sendButton.setEnabled(false); // Enabled when a group is selected
+		sendButton.setEnabled(false); // Enabled after loading the group
 		sendButton.setOnClickListener(this);
 		header.addView(sendButton);
 		layout.addView(header);
 
-		header = new LinearLayout(this);
-		header.setLayoutParams(MATCH_WRAP);
-		header.setOrientation(HORIZONTAL);
-		header.setGravity(CENTER_VERTICAL);
-
-		TextView to = new TextView(this);
+		to = new TextView(this);
 		to.setTextSize(18);
-		to.setPadding(10, 0, 0, 10);
+		to.setPadding(10, 0, 10, 10);
 		to.setText(R.string.to);
-		header.addView(to);
-
-		toAdapter = new GroupSpinnerAdapter(this);
-		toSpinner = new Spinner(this);
-		toSpinner.setAdapter(toAdapter);
-		toSpinner.setOnItemSelectedListener(this);
-		header.addView(toSpinner);
-		layout.addView(header);
+		layout.addView(to);
 
 		content = new EditText(this);
 		content.setId(1);
@@ -158,21 +145,21 @@ implements OnItemSelectedListener, OnClickListener {
 	@Override
 	public void onResume() {
 		super.onResume();
-		loadLocalAuthors();
-		loadGroups();
+		loadAuthorsAndGroup();
 	}
 
-	private void loadLocalAuthors() {
+	private void loadAuthorsAndGroup() {
 		dbUiExecutor.execute(new Runnable() {
 			public void run() {
 				try {
 					lifecycleManager.waitForDatabase();
 					long now = System.currentTimeMillis();
 					Collection<LocalAuthor> localAuthors = db.getLocalAuthors();
+					group = db.getGroup(groupId);
 					long duration = System.currentTimeMillis() - now;
 					if(LOG.isLoggable(INFO))
-						LOG.info("Loading authors took " + duration + " ms");
-					displayLocalAuthors(localAuthors);
+						LOG.info("Load took " + duration + " ms");
+					displayAuthorsAndGroup(localAuthors);
 				} catch(DbException e) {
 					if(LOG.isLoggable(WARNING))
 						LOG.log(WARNING, e.toString(), e);
@@ -184,73 +171,31 @@ implements OnItemSelectedListener, OnClickListener {
 		});
 	}
 
-	private void displayLocalAuthors(
+	private void displayAuthorsAndGroup(
 			final Collection<LocalAuthor> localAuthors) {
 		runOnUiThread(new Runnable() {
 			public void run() {
 				if(localAuthors.isEmpty()) throw new IllegalStateException();
-				fromAdapter.clear();
+				adapter.clear();
 				for(LocalAuthor a : localAuthors)
-					fromAdapter.add(new LocalAuthorItem(a));
-				fromAdapter.sort(LocalAuthorItemComparator.INSTANCE);
-				fromAdapter.notifyDataSetChanged();
-				int count = fromAdapter.getCount();
+					adapter.add(new LocalAuthorItem(a));
+				adapter.sort(LocalAuthorItemComparator.INSTANCE);
+				adapter.notifyDataSetChanged();
+				int count = adapter.getCount();
 				for(int i = 0; i < count; i++) {
-					LocalAuthorItem item = fromAdapter.getItem(i);
+					LocalAuthorItem item = adapter.getItem(i);
 					if(item == LocalAuthorItem.ANONYMOUS) continue;
 					if(item == LocalAuthorItem.NEW) continue;
 					if(item.getLocalAuthor().getId().equals(localAuthorId)) {
 						localAuthor = item.getLocalAuthor();
-						fromSpinner.setSelection(i);
-						break;
-					}
-				}
-			}
-		});
-	}
-
-	private void loadGroups() {
-		dbUiExecutor.execute(new Runnable() {
-			public void run() {
-				try {
-					lifecycleManager.waitForDatabase();
-					long now = System.currentTimeMillis();
-					Collection<Group> groups = new ArrayList<Group>();
-					for(GroupStatus s : db.getAvailableGroups())
-						if(s.isSubscribed()) groups.add(s.getGroup());
-					long duration = System.currentTimeMillis() - now;
-					if(LOG.isLoggable(INFO))
-						LOG.info("Loading groups took " + duration + " ms");
-					displayGroups(groups);
-				} catch(DbException e) {
-					if(LOG.isLoggable(WARNING))
-						LOG.log(WARNING, e.toString(), e);
-				} catch(InterruptedException e) {
-					LOG.info("Interrupted while waiting for database");
-					Thread.currentThread().interrupt();
-				}
-			}
-		});
-	}
-
-	private void displayGroups(final Collection<Group> groups) {
-		runOnUiThread(new Runnable() {
-			public void run() {
-				if(groups.isEmpty()) finish();
-				toAdapter.clear();
-				for(Group g : groups) toAdapter.add(new GroupItem(g));
-				toAdapter.sort(GroupItemComparator.INSTANCE);
-				toAdapter.notifyDataSetChanged();
-				int count = toAdapter.getCount();
-				for(int i = 0; i < count; i++) {
-					GroupItem g = toAdapter.getItem(i);
-					if(g == GroupItem.NEW) continue;
-					if(g.getGroup().getId().equals(groupId)) {
-						group = g.getGroup();
-						toSpinner.setSelection(i);
+						spinner.setSelection(i);
 						break;
 					}
 				}
+				Resources res = getResources();
+				String format = res.getString(R.string.format_to);
+				to.setText(String.format(format, group.getName()));
+				sendButton.setEnabled(true);
 			}
 		});
 	}
@@ -270,8 +215,7 @@ implements OnItemSelectedListener, OnClickListener {
 
 	public void onItemSelected(AdapterView<?> parent, View view, int position,
 			long id) {
-		if(parent == fromSpinner) {
-			LocalAuthorItem item = fromAdapter.getItem(position);
+			LocalAuthorItem item = adapter.getItem(position);
 			if(item == LocalAuthorItem.ANONYMOUS) {
 				localAuthor = null;
 				localAuthorId = null;
@@ -283,29 +227,11 @@ implements OnItemSelectedListener, OnClickListener {
 				localAuthor = item.getLocalAuthor();
 				localAuthorId = localAuthor.getId();
 			}
-		} else if(parent == toSpinner) {
-			GroupItem item = toAdapter.getItem(position);
-			if(item == GroupItem.NEW) {
-				group = null;
-				groupId = null;
-				startActivity(new Intent(this, CreateGroupActivity.class));
-			} else {
-				group = item.getGroup();
-				groupId = group.getId();
-				sendButton.setEnabled(true);
-			}
-		}
 	}
 
 	public void onNothingSelected(AdapterView<?> parent) {
-		if(parent == fromSpinner) {
 			localAuthor = null;
 			localAuthorId = null;
-		} else if(parent == toSpinner) {
-			group = null;
-			groupId = null;
-			sendButton.setEnabled(false);
-		}
 	}
 
 	public void onClick(View view) {
-- 
GitLab