provide up navigation in start conversation activity
This commit is contained in:
parent
cc54f02ab3
commit
c59ee9e137
|
@ -571,6 +571,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
navigateBack();
|
||||||
|
return true;
|
||||||
case R.id.action_join_conference:
|
case R.id.action_join_conference:
|
||||||
showJoinConferenceDialog(null);
|
showJoinConferenceDialog(null);
|
||||||
return true;
|
return true;
|
||||||
|
@ -688,6 +691,17 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void configureHomeButton() {
|
||||||
|
final ActionBar actionBar = getSupportActionBar();
|
||||||
|
if (actionBar == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean openConversations = !xmppConnectionService.isConversationsListEmpty(null);
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(openConversations);
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(openConversations);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBackendConnected() {
|
protected void onBackendConnected() {
|
||||||
if (mPostponedActivityResult != null) {
|
if (mPostponedActivityResult != null) {
|
||||||
|
@ -704,13 +718,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final ActionBar ab = getSupportActionBar();
|
configureHomeButton();
|
||||||
boolean noConversations = xmppConnectionService.getConversations().size() == 0;
|
|
||||||
if (noConversations && ab != null) {
|
|
||||||
ab.setDisplayShowHomeEnabled(false);
|
|
||||||
ab.setDisplayHomeAsUpEnabled(false);
|
|
||||||
ab.setHomeButtonEnabled(false);
|
|
||||||
}
|
|
||||||
Intent intent = pendingViewIntent.pop();
|
Intent intent = pendingViewIntent.pop();
|
||||||
if (intent != null && processViewIntent(intent)) {
|
if (intent != null && processViewIntent(intent)) {
|
||||||
filter(null);
|
filter(null);
|
||||||
|
@ -883,6 +891,21 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
if (mSearchEditText != null) {
|
if (mSearchEditText != null) {
|
||||||
filter(mSearchEditText.getText().toString());
|
filter(mSearchEditText.getText().toString());
|
||||||
}
|
}
|
||||||
|
configureHomeButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
navigateBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void navigateBack() {
|
||||||
|
if (xmppConnectionService != null && !xmppConnectionService.isConversationsListEmpty(null)) {
|
||||||
|
Intent intent = new Intent(this, ConversationsActivity.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue