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 Toast prepareFileToast;
|
||||||
|
|
||||||
private boolean mActivityPaused = false;
|
private boolean mActivityPaused = false;
|
||||||
|
private boolean mRedirected = true;
|
||||||
|
|
||||||
public Conversation getSelectedConversation() {
|
public Conversation getSelectedConversation() {
|
||||||
return this.mSelectedConversation;
|
return this.mSelectedConversation;
|
||||||
|
@ -720,6 +721,7 @@ public class ConversationActivity extends XmppActivity
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
this.mRedirected = false;
|
||||||
if (this.xmppConnectionServiceBound) {
|
if (this.xmppConnectionServiceBound) {
|
||||||
this.onBackendConnected();
|
this.onBackendConnected();
|
||||||
}
|
}
|
||||||
|
@ -776,11 +778,19 @@ public class ConversationActivity extends XmppActivity
|
||||||
this.xmppConnectionService.getNotificationService().setIsInForeground(true);
|
this.xmppConnectionService.getNotificationService().setIsInForeground(true);
|
||||||
updateConversationList();
|
updateConversationList();
|
||||||
if (xmppConnectionService.getAccounts().size() == 0) {
|
if (xmppConnectionService.getAccounts().size() == 0) {
|
||||||
|
if (!mRedirected) {
|
||||||
|
this.mRedirected = true;
|
||||||
startActivity(new Intent(this, EditAccountActivity.class));
|
startActivity(new Intent(this, EditAccountActivity.class));
|
||||||
finish();
|
finish();
|
||||||
|
}
|
||||||
} else if (conversationList.size() <= 0) {
|
} else if (conversationList.size() <= 0) {
|
||||||
startActivity(new Intent(this, StartConversationActivity.class));
|
if (!mRedirected) {
|
||||||
|
this.mRedirected = true;
|
||||||
|
Intent intent = new Intent(this, StartConversationActivity.class);
|
||||||
|
intent.putExtra("init",true);
|
||||||
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
}
|
||||||
} else if (getIntent() != null && VIEW_CONVERSATION.equals(getIntent().getType())) {
|
} else if (getIntent() != null && VIEW_CONVERSATION.equals(getIntent().getType())) {
|
||||||
handleViewConversationIntent(getIntent());
|
handleViewConversationIntent(getIntent());
|
||||||
} else if (selectConversationByUuid(mOpenConverstaion)) {
|
} else if (selectConversationByUuid(mOpenConverstaion)) {
|
||||||
|
@ -1010,11 +1020,19 @@ public class ConversationActivity extends XmppActivity
|
||||||
protected void refreshUiReal() {
|
protected void refreshUiReal() {
|
||||||
updateConversationList();
|
updateConversationList();
|
||||||
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 0) {
|
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 0) {
|
||||||
|
if (!mRedirected) {
|
||||||
|
this.mRedirected = true;
|
||||||
startActivity(new Intent(this, EditAccountActivity.class));
|
startActivity(new Intent(this, EditAccountActivity.class));
|
||||||
finish();
|
finish();
|
||||||
|
}
|
||||||
} else if (conversationList.size() == 0) {
|
} else if (conversationList.size() == 0) {
|
||||||
startActivity(new Intent(this, StartConversationActivity.class));
|
if (!mRedirected) {
|
||||||
|
this.mRedirected = true;
|
||||||
|
Intent intent = new Intent(this, StartConversationActivity.class);
|
||||||
|
intent.putExtra("init",true);
|
||||||
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ConversationActivity.this.mConversationFragment.updateMessages();
|
ConversationActivity.this.mConversationFragment.updateMessages();
|
||||||
updateActionBarTitle();
|
updateActionBarTitle();
|
||||||
|
|
|
@ -221,6 +221,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||||
if (avatar != null) {
|
if (avatar != null) {
|
||||||
intent = new Intent(getApplicationContext(),
|
intent = new Intent(getApplicationContext(),
|
||||||
StartConversationActivity.class);
|
StartConversationActivity.class);
|
||||||
|
intent.putExtra("init",true);
|
||||||
} else {
|
} else {
|
||||||
intent = new Intent(getApplicationContext(),
|
intent = new Intent(getApplicationContext(),
|
||||||
PublishProfilePictureActivity.class);
|
PublishProfilePictureActivity.class);
|
||||||
|
@ -379,6 +380,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||||
if (getActionBar() != null) {
|
if (getActionBar() != null) {
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(false);
|
getActionBar().setDisplayHomeAsUpEnabled(false);
|
||||||
getActionBar().setDisplayShowHomeEnabled(false);
|
getActionBar().setDisplayShowHomeEnabled(false);
|
||||||
|
getActionBar().setHomeButtonEnabled(false);
|
||||||
}
|
}
|
||||||
this.mCancelButton.setEnabled(false);
|
this.mCancelButton.setEnabled(false);
|
||||||
this.mCancelButton.setTextColor(getSecondaryTextColor());
|
this.mCancelButton.setTextColor(getSecondaryTextColor());
|
||||||
|
|
|
@ -54,8 +54,10 @@ public class PublishProfilePictureActivity extends XmppActivity {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mInitialAccountSetup) {
|
if (mInitialAccountSetup) {
|
||||||
startActivity(new Intent(getApplicationContext(),
|
Intent intent = new Intent(getApplicationContext(),
|
||||||
StartConversationActivity.class));
|
StartConversationActivity.class);
|
||||||
|
intent.putExtra("init",true);
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
Toast.makeText(PublishProfilePictureActivity.this,
|
Toast.makeText(PublishProfilePictureActivity.this,
|
||||||
R.string.avatar_has_been_published,
|
R.string.avatar_has_been_published,
|
||||||
|
@ -112,8 +114,10 @@ public class PublishProfilePictureActivity extends XmppActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (mInitialAccountSetup) {
|
if (mInitialAccountSetup) {
|
||||||
startActivity(new Intent(getApplicationContext(),
|
Intent intent = new Intent(getApplicationContext(),
|
||||||
StartConversationActivity.class));
|
StartConversationActivity.class);
|
||||||
|
intent.putExtra("init",true);
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -574,9 +574,15 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
this.mActivatedAccounts.add(account.getJid().toBareJid().toString());
|
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.mKnownHosts = xmppConnectionService.getKnownHosts();
|
||||||
this.mKnownConferenceHosts = xmppConnectionService
|
this.mKnownConferenceHosts = xmppConnectionService.getKnownConferenceHosts();
|
||||||
.getKnownConferenceHosts();
|
|
||||||
if (this.mPendingInvite != null) {
|
if (this.mPendingInvite != null) {
|
||||||
mPendingInvite.invite();
|
mPendingInvite.invite();
|
||||||
this.mPendingInvite = null;
|
this.mPendingInvite = null;
|
||||||
|
|
Loading…
Reference in a new issue