init mode (first start) for StartConversationActivity (no up button) and avoid being started multiple times. fixed #995
This commit is contained in:
parent
7259e666ea
commit
da2da75756
|
@ -84,6 +84,7 @@ public class ConversationActivity extends XmppActivity
|
|||
private Toast prepareFileToast;
|
||||
|
||||
private boolean mActivityPaused = false;
|
||||
private boolean mRedirected = true;
|
||||
|
||||
public Conversation getSelectedConversation() {
|
||||
return this.mSelectedConversation;
|
||||
|
@ -720,6 +721,7 @@ public class ConversationActivity extends XmppActivity
|
|||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
this.mRedirected = false;
|
||||
if (this.xmppConnectionServiceBound) {
|
||||
this.onBackendConnected();
|
||||
}
|
||||
|
@ -776,11 +778,19 @@ public class ConversationActivity extends XmppActivity
|
|||
this.xmppConnectionService.getNotificationService().setIsInForeground(true);
|
||||
updateConversationList();
|
||||
if (xmppConnectionService.getAccounts().size() == 0) {
|
||||
startActivity(new Intent(this, EditAccountActivity.class));
|
||||
finish();
|
||||
if (!mRedirected) {
|
||||
this.mRedirected = true;
|
||||
startActivity(new Intent(this, EditAccountActivity.class));
|
||||
finish();
|
||||
}
|
||||
} else if (conversationList.size() <= 0) {
|
||||
startActivity(new Intent(this, StartConversationActivity.class));
|
||||
finish();
|
||||
if (!mRedirected) {
|
||||
this.mRedirected = true;
|
||||
Intent intent = new Intent(this, StartConversationActivity.class);
|
||||
intent.putExtra("init",true);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
} else if (getIntent() != null && VIEW_CONVERSATION.equals(getIntent().getType())) {
|
||||
handleViewConversationIntent(getIntent());
|
||||
} else if (selectConversationByUuid(mOpenConverstaion)) {
|
||||
|
@ -1010,11 +1020,19 @@ public class ConversationActivity extends XmppActivity
|
|||
protected void refreshUiReal() {
|
||||
updateConversationList();
|
||||
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 0) {
|
||||
startActivity(new Intent(this, EditAccountActivity.class));
|
||||
finish();
|
||||
if (!mRedirected) {
|
||||
this.mRedirected = true;
|
||||
startActivity(new Intent(this, EditAccountActivity.class));
|
||||
finish();
|
||||
}
|
||||
} else if (conversationList.size() == 0) {
|
||||
startActivity(new Intent(this, StartConversationActivity.class));
|
||||
finish();
|
||||
if (!mRedirected) {
|
||||
this.mRedirected = true;
|
||||
Intent intent = new Intent(this, StartConversationActivity.class);
|
||||
intent.putExtra("init",true);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
ConversationActivity.this.mConversationFragment.updateMessages();
|
||||
updateActionBarTitle();
|
||||
|
|
|
@ -221,6 +221,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
|||
if (avatar != null) {
|
||||
intent = new Intent(getApplicationContext(),
|
||||
StartConversationActivity.class);
|
||||
intent.putExtra("init",true);
|
||||
} else {
|
||||
intent = new Intent(getApplicationContext(),
|
||||
PublishProfilePictureActivity.class);
|
||||
|
@ -379,6 +380,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
|||
if (getActionBar() != null) {
|
||||
getActionBar().setDisplayHomeAsUpEnabled(false);
|
||||
getActionBar().setDisplayShowHomeEnabled(false);
|
||||
getActionBar().setHomeButtonEnabled(false);
|
||||
}
|
||||
this.mCancelButton.setEnabled(false);
|
||||
this.mCancelButton.setTextColor(getSecondaryTextColor());
|
||||
|
|
|
@ -54,8 +54,10 @@ public class PublishProfilePictureActivity extends XmppActivity {
|
|||
@Override
|
||||
public void run() {
|
||||
if (mInitialAccountSetup) {
|
||||
startActivity(new Intent(getApplicationContext(),
|
||||
StartConversationActivity.class));
|
||||
Intent intent = new Intent(getApplicationContext(),
|
||||
StartConversationActivity.class);
|
||||
intent.putExtra("init",true);
|
||||
startActivity(intent);
|
||||
}
|
||||
Toast.makeText(PublishProfilePictureActivity.this,
|
||||
R.string.avatar_has_been_published,
|
||||
|
@ -112,8 +114,10 @@ public class PublishProfilePictureActivity extends XmppActivity {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mInitialAccountSetup) {
|
||||
startActivity(new Intent(getApplicationContext(),
|
||||
StartConversationActivity.class));
|
||||
Intent intent = new Intent(getApplicationContext(),
|
||||
StartConversationActivity.class);
|
||||
intent.putExtra("init",true);
|
||||
startActivity(intent);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -574,9 +574,15 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
|||
this.mActivatedAccounts.add(account.getJid().toBareJid().toString());
|
||||
}
|
||||
}
|
||||
final Intent intent = getIntent();
|
||||
final ActionBar ab = getActionBar();
|
||||
if (intent != null && intent.getBooleanExtra("init",false) && ab != null) {
|
||||
ab.setDisplayShowHomeEnabled(false);
|
||||
ab.setDisplayHomeAsUpEnabled(false);
|
||||
ab.setHomeButtonEnabled(false);
|
||||
}
|
||||
this.mKnownHosts = xmppConnectionService.getKnownHosts();
|
||||
this.mKnownConferenceHosts = xmppConnectionService
|
||||
.getKnownConferenceHosts();
|
||||
this.mKnownConferenceHosts = xmppConnectionService.getKnownConferenceHosts();
|
||||
if (this.mPendingInvite != null) {
|
||||
mPendingInvite.invite();
|
||||
this.mPendingInvite = null;
|
||||
|
|
Loading…
Reference in a new issue