mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 14:49:53 +01:00
Fixed crash when rotating screen with dialog visible.
Fixes issue #3612299.
This commit is contained in:
@@ -29,6 +29,8 @@ import net.sf.briar.api.messaging.GroupId;
|
|||||||
import roboguice.activity.RoboFragmentActivity;
|
import roboguice.activity.RoboFragmentActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@@ -53,6 +55,8 @@ SelectContactsDialog.Listener {
|
|||||||
private RadioButton visibleToAll = null, visibleToSome = null;
|
private RadioButton visibleToAll = null, visibleToSome = null;
|
||||||
private Button doneButton = null;
|
private Button doneButton = null;
|
||||||
private ProgressBar progress = null;
|
private ProgressBar progress = null;
|
||||||
|
private NoContactsDialog noContactsDialog = null;
|
||||||
|
private SelectContactsDialog selectContactsDialog = null;
|
||||||
|
|
||||||
// Fields that are accessed from background threads must be volatile
|
// Fields that are accessed from background threads must be volatile
|
||||||
@Inject private volatile DatabaseComponent db;
|
@Inject private volatile DatabaseComponent db;
|
||||||
@@ -124,6 +128,17 @@ SelectContactsDialog.Listener {
|
|||||||
layout.addView(progress);
|
layout.addView(progress);
|
||||||
|
|
||||||
setContentView(layout);
|
setContentView(layout);
|
||||||
|
|
||||||
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
|
Fragment f = fm.findFragmentByTag("NoContactsDialog");
|
||||||
|
if(f == null) noContactsDialog = new NoContactsDialog();
|
||||||
|
else noContactsDialog = (NoContactsDialog) f;
|
||||||
|
noContactsDialog.setListener(this);
|
||||||
|
|
||||||
|
f = fm.findFragmentByTag("SelectContactsDialog");
|
||||||
|
if(f == null) selectContactsDialog = new SelectContactsDialog();
|
||||||
|
else selectContactsDialog = (SelectContactsDialog) f;
|
||||||
|
selectContactsDialog.setListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
@@ -173,17 +188,12 @@ SelectContactsDialog.Listener {
|
|||||||
private void displayContacts(final Collection<Contact> contacts) {
|
private void displayContacts(final Collection<Contact> contacts) {
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
if(contacts.isEmpty()) {
|
if(contacts.isEmpty()) {
|
||||||
NoContactsDialog dialog = new NoContactsDialog();
|
noContactsDialog.show(fm, "NoContactsDialog");
|
||||||
dialog.setListener(ConfigureBlogActivity.this);
|
|
||||||
dialog.show(getSupportFragmentManager(),
|
|
||||||
"NoContactsDialog");
|
|
||||||
} else {
|
} else {
|
||||||
SelectContactsDialog dialog = new SelectContactsDialog();
|
selectContactsDialog.setContacts(contacts);
|
||||||
dialog.setListener(ConfigureBlogActivity.this);
|
selectContactsDialog.show(fm, "SelectContactsDialog");
|
||||||
dialog.setContacts(contacts);
|
|
||||||
dialog.show(getSupportFragmentManager(),
|
|
||||||
"SelectContactsDialog");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ import net.sf.briar.api.messaging.LocalGroup;
|
|||||||
import roboguice.activity.RoboFragmentActivity;
|
import roboguice.activity.RoboFragmentActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@@ -65,6 +67,8 @@ SelectContactsDialog.Listener {
|
|||||||
private RadioButton visibleToAll = null, visibleToSome = null;
|
private RadioButton visibleToAll = null, visibleToSome = null;
|
||||||
private Button createButton = null;
|
private Button createButton = null;
|
||||||
private ProgressBar progress = null;
|
private ProgressBar progress = null;
|
||||||
|
private NoContactsDialog noContactsDialog = null;
|
||||||
|
private SelectContactsDialog selectContactsDialog = null;
|
||||||
|
|
||||||
// Fields that are accessed from background threads must be volatile
|
// Fields that are accessed from background threads must be volatile
|
||||||
@Inject private volatile CryptoComponent crypto;
|
@Inject private volatile CryptoComponent crypto;
|
||||||
@@ -132,6 +136,17 @@ SelectContactsDialog.Listener {
|
|||||||
layout.addView(progress);
|
layout.addView(progress);
|
||||||
|
|
||||||
setContentView(layout);
|
setContentView(layout);
|
||||||
|
|
||||||
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
|
Fragment f = fm.findFragmentByTag("NoContactsDialog");
|
||||||
|
if(f == null) noContactsDialog = new NoContactsDialog();
|
||||||
|
else noContactsDialog = (NoContactsDialog) f;
|
||||||
|
noContactsDialog.setListener(this);
|
||||||
|
|
||||||
|
f = fm.findFragmentByTag("SelectContactsDialog");
|
||||||
|
if(f == null) selectContactsDialog = new SelectContactsDialog();
|
||||||
|
else selectContactsDialog = (SelectContactsDialog) f;
|
||||||
|
selectContactsDialog.setListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableOrDisableCreateButton() {
|
private void enableOrDisableCreateButton() {
|
||||||
@@ -206,17 +221,12 @@ SelectContactsDialog.Listener {
|
|||||||
private void displayContacts(final Collection<Contact> contacts) {
|
private void displayContacts(final Collection<Contact> contacts) {
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
if(contacts.isEmpty()) {
|
if(contacts.isEmpty()) {
|
||||||
NoContactsDialog dialog = new NoContactsDialog();
|
noContactsDialog.show(fm, "NoContactsDialog");
|
||||||
dialog.setListener(CreateBlogActivity.this);
|
|
||||||
dialog.show(getSupportFragmentManager(),
|
|
||||||
"NoContactsDialog");
|
|
||||||
} else {
|
} else {
|
||||||
SelectContactsDialog dialog = new SelectContactsDialog();
|
selectContactsDialog.setContacts(contacts);
|
||||||
dialog.setListener(CreateBlogActivity.this);
|
selectContactsDialog.show(fm, "SelectContactsDialog");
|
||||||
dialog.setContacts(contacts);
|
|
||||||
dialog.show(getSupportFragmentManager(),
|
|
||||||
"SelectContactsDialog");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import net.sf.briar.api.messaging.GroupId;
|
|||||||
import roboguice.activity.RoboFragmentActivity;
|
import roboguice.activity.RoboFragmentActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@@ -53,6 +55,8 @@ SelectContactsDialog.Listener {
|
|||||||
private RadioButton visibleToAll = null, visibleToSome = null;
|
private RadioButton visibleToAll = null, visibleToSome = null;
|
||||||
private Button doneButton = null;
|
private Button doneButton = null;
|
||||||
private ProgressBar progress = null;
|
private ProgressBar progress = null;
|
||||||
|
private NoContactsDialog noContactsDialog = null;
|
||||||
|
private SelectContactsDialog selectContactsDialog = null;
|
||||||
|
|
||||||
// Fields that are accessed from background threads must be volatile
|
// Fields that are accessed from background threads must be volatile
|
||||||
@Inject private volatile DatabaseComponent db;
|
@Inject private volatile DatabaseComponent db;
|
||||||
@@ -122,6 +126,17 @@ SelectContactsDialog.Listener {
|
|||||||
layout.addView(progress);
|
layout.addView(progress);
|
||||||
|
|
||||||
setContentView(layout);
|
setContentView(layout);
|
||||||
|
|
||||||
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
|
Fragment f = fm.findFragmentByTag("NoContactsDialog");
|
||||||
|
if(f == null) noContactsDialog = new NoContactsDialog();
|
||||||
|
else noContactsDialog = (NoContactsDialog) f;
|
||||||
|
noContactsDialog.setListener(this);
|
||||||
|
|
||||||
|
f = fm.findFragmentByTag("SelectContactsDialog");
|
||||||
|
if(f == null) selectContactsDialog = new SelectContactsDialog();
|
||||||
|
else selectContactsDialog = (SelectContactsDialog) f;
|
||||||
|
selectContactsDialog.setListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
@@ -171,17 +186,12 @@ SelectContactsDialog.Listener {
|
|||||||
private void displayContacts(final Collection<Contact> contacts) {
|
private void displayContacts(final Collection<Contact> contacts) {
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
if(contacts.isEmpty()) {
|
if(contacts.isEmpty()) {
|
||||||
NoContactsDialog dialog = new NoContactsDialog();
|
noContactsDialog.show(fm, "NoContactsDialog");
|
||||||
dialog.setListener(ConfigureGroupActivity.this);
|
|
||||||
dialog.show(getSupportFragmentManager(),
|
|
||||||
"NoContactsDialog");
|
|
||||||
} else {
|
} else {
|
||||||
SelectContactsDialog dialog = new SelectContactsDialog();
|
selectContactsDialog.setContacts(contacts);
|
||||||
dialog.setListener(ConfigureGroupActivity.this);
|
selectContactsDialog.show(fm, "SelectContactsDialog");
|
||||||
dialog.setContacts(contacts);
|
|
||||||
dialog.show(getSupportFragmentManager(),
|
|
||||||
"SelectContactsDialog");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import net.sf.briar.api.messaging.GroupFactory;
|
|||||||
import roboguice.activity.RoboFragmentActivity;
|
import roboguice.activity.RoboFragmentActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@@ -61,6 +63,8 @@ SelectContactsDialog.Listener {
|
|||||||
private RadioButton visibleToAll = null, visibleToSome = null;
|
private RadioButton visibleToAll = null, visibleToSome = null;
|
||||||
private Button createButton = null;
|
private Button createButton = null;
|
||||||
private ProgressBar progress = null;
|
private ProgressBar progress = null;
|
||||||
|
private NoContactsDialog noContactsDialog = null;
|
||||||
|
private SelectContactsDialog selectContactsDialog = null;
|
||||||
|
|
||||||
// Fields that are accessed from background threads must be volatile
|
// Fields that are accessed from background threads must be volatile
|
||||||
@Inject private volatile GroupFactory groupFactory;
|
@Inject private volatile GroupFactory groupFactory;
|
||||||
@@ -126,6 +130,17 @@ SelectContactsDialog.Listener {
|
|||||||
layout.addView(progress);
|
layout.addView(progress);
|
||||||
|
|
||||||
setContentView(layout);
|
setContentView(layout);
|
||||||
|
|
||||||
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
|
Fragment f = fm.findFragmentByTag("NoContactsDialog");
|
||||||
|
if(f == null) noContactsDialog = new NoContactsDialog();
|
||||||
|
else noContactsDialog = (NoContactsDialog) f;
|
||||||
|
noContactsDialog.setListener(this);
|
||||||
|
|
||||||
|
f = fm.findFragmentByTag("SelectContactsDialog");
|
||||||
|
if(f == null) selectContactsDialog = new SelectContactsDialog();
|
||||||
|
else selectContactsDialog = (SelectContactsDialog) f;
|
||||||
|
selectContactsDialog.setListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableOrDisableCreateButton() {
|
private void enableOrDisableCreateButton() {
|
||||||
@@ -215,17 +230,12 @@ SelectContactsDialog.Listener {
|
|||||||
private void displayContacts(final Collection<Contact> contacts) {
|
private void displayContacts(final Collection<Contact> contacts) {
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
if(contacts.isEmpty()) {
|
if(contacts.isEmpty()) {
|
||||||
NoContactsDialog dialog = new NoContactsDialog();
|
noContactsDialog.show(fm, "NoContactsDialog");
|
||||||
dialog.setListener(CreateGroupActivity.this);
|
|
||||||
dialog.show(getSupportFragmentManager(),
|
|
||||||
"NoContactsDialog");
|
|
||||||
} else {
|
} else {
|
||||||
SelectContactsDialog dialog = new SelectContactsDialog();
|
selectContactsDialog.setContacts(contacts);
|
||||||
dialog.setListener(CreateGroupActivity.this);
|
selectContactsDialog.show(fm, "SelectContactsDialog");
|
||||||
dialog.setContacts(contacts);
|
|
||||||
dialog.show(getSupportFragmentManager(),
|
|
||||||
"SelectContactsDialog");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import net.sf.briar.api.lifecycle.LifecycleManager;
|
|||||||
import roboguice.activity.RoboFragmentActivity;
|
import roboguice.activity.RoboFragmentActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
@@ -51,6 +53,7 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener {
|
|||||||
private ConversationListAdapter adapter = null;
|
private ConversationListAdapter adapter = null;
|
||||||
private ListView list = null;
|
private ListView list = null;
|
||||||
private ListLoadingProgressBar loading = null;
|
private ListLoadingProgressBar loading = null;
|
||||||
|
private NoContactsDialog noContactsDialog = null;
|
||||||
|
|
||||||
// Fields that are accessed from background threads must be volatile
|
// Fields that are accessed from background threads must be volatile
|
||||||
@Inject private volatile DatabaseComponent db;
|
@Inject private volatile DatabaseComponent db;
|
||||||
@@ -87,6 +90,12 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener {
|
|||||||
layout.addView(composeButton);
|
layout.addView(composeButton);
|
||||||
|
|
||||||
setContentView(layout);
|
setContentView(layout);
|
||||||
|
|
||||||
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
|
Fragment f = fm.findFragmentByTag("NoContactsDialog");
|
||||||
|
if(f == null) noContactsDialog = new NoContactsDialog();
|
||||||
|
else noContactsDialog = (NoContactsDialog) f;
|
||||||
|
noContactsDialog.setListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -186,9 +195,8 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener {
|
|||||||
|
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if(adapter.isEmpty()) {
|
if(adapter.isEmpty()) {
|
||||||
NoContactsDialog dialog = new NoContactsDialog();
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
dialog.setListener(this);
|
noContactsDialog.show(fm, "NoContactsDialog");
|
||||||
dialog.show(getSupportFragmentManager(), "NoContactsDialog");
|
|
||||||
} else {
|
} else {
|
||||||
startActivity(new Intent(this, WritePrivateMessageActivity.class));
|
startActivity(new Intent(this, WritePrivateMessageActivity.class));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user