Show newly created forums after creating them.

This commit is contained in:
akwizgran
2014-03-01 11:45:13 +00:00
parent 0bab22db38
commit ebe1db9fb1
4 changed files with 29 additions and 4 deletions

View File

@@ -40,7 +40,7 @@
<string name="exchanging_contact_details">Exchanging contact details\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_toast">Contact added</string>
<string name="contact_added_toast">Contact added: %s</string>
<string name="no_private_messages">No messages</string>
<string name="private_message_hint">Type message</string>
<string name="message_sent_toast">Message sent</string>
@@ -58,6 +58,7 @@
<string name="forum_visible_to_all">Share this forum with all contacts</string>
<string name="forum_visible_to_some">Share this forum with chosen contacts</string>
<string name="done_button">Done</string>
<string name="forum_created_toast">Forum created</string>
<string name="from">From:</string>
<string name="anonymous">Anonymous</string>
<string name="new_identity_item">New identity\u2026</string>
@@ -69,11 +70,11 @@
<string name="not_subscribed">Not subscribed</string>
<string name="new_identity_title">New Identity</string>
<string name="create_button">Create</string>
<string name="identity_created_toast">Identity created</string>
<string name="no_contacts_prompt">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="post_sent_toast">Post sent</string>
<string name="not_implemented_toast">Not implemented yet!</string>
<string name="private_message_notification_title">New private message</string>
<string name="private_message_notification_text">Touch to show.</string>
<string name="group_post_notification_title">New forum post</string>

View File

@@ -8,6 +8,7 @@ import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static android.view.inputmethod.InputMethodManager.HIDE_IMPLICIT_ONLY;
import static android.widget.LinearLayout.VERTICAL;
import static android.widget.Toast.LENGTH_LONG;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH;
@@ -48,6 +49,7 @@ import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.TextView.OnEditorActionListener;
public class CreateGroupActivity extends BriarActivity
@@ -184,11 +186,27 @@ SelectContactsDialog.Listener {
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
LOG.info("Storing group took " + duration + " ms");
displayGroup(g);
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
finishOnUiThread();
}
finishOnUiThread();
}
});
}
private void displayGroup(final Group g) {
runOnUiThread(new Runnable() {
public void run() {
Intent i = new Intent(CreateGroupActivity.this,
GroupActivity.class);
i.putExtra("briar.GROUP_ID", g.getId().getBytes());
i.putExtra("briar.GROUP_NAME", g.getName());
startActivity(i);
Toast.makeText(CreateGroupActivity.this,
R.string.forum_created_toast, LENGTH_LONG).show();
finish();
}
});
}

View File

@@ -8,6 +8,7 @@ import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static android.view.inputmethod.InputMethodManager.HIDE_IMPLICIT_ONLY;
import static android.widget.LinearLayout.VERTICAL;
import static android.widget.Toast.LENGTH_LONG;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH;
@@ -43,6 +44,7 @@ import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import android.widget.Toast;
public class CreateIdentityActivity extends BriarActivity
implements OnEditorActionListener, OnClickListener {
@@ -165,6 +167,8 @@ implements OnEditorActionListener, OnClickListener {
Intent i = new Intent();
i.putExtra("briar.LOCAL_AUTHOR_ID", a.getId().getBytes());
setResult(RESULT_OK, i);
Toast.makeText(CreateIdentityActivity.this,
R.string.identity_created_toast, LENGTH_LONG).show();
finish();
}
});

View File

@@ -132,7 +132,9 @@ implements InvitationListener {
}
private void showToastAndFinish() {
Toast.makeText(this, R.string.contact_added_toast, LENGTH_LONG).show();
String format = getResources().getString(R.string.contact_added_toast);
String text = String.format(format, contactName);
Toast.makeText(this, text, LENGTH_LONG).show();
finish();
}