diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
3 files changed, 18 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ActionBarActivity.java b/src/main/java/de/pixart/messenger/ui/ActionBarActivity.java index 06dad3d13..bc0557f1f 100644 --- a/src/main/java/de/pixart/messenger/ui/ActionBarActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ActionBarActivity.java @@ -2,6 +2,7 @@ package de.pixart.messenger.ui; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; +import android.view.MenuItem; public abstract class ActionBarActivity extends AppCompatActivity { public static void configureActionBar(ActionBar actionBar) { @@ -14,4 +15,14 @@ public abstract class ActionBarActivity extends AppCompatActivity { actionBar.setDisplayHomeAsUpEnabled(upNavigation); } } + + @Override + public boolean onOptionsItemSelected(final MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + break; + } + return super.onOptionsItemSelected(item); + } } diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index 60c94042d..1edbafd67 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -99,6 +99,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne private EditText mSearchEditText; private AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false); private boolean mHideOfflineContacts = false; + private boolean createdByViewIntent = false; private MenuItem.OnActionExpandListener mOnActionExpandListener = new MenuItem.OnActionExpandListener() { @Override @@ -302,6 +303,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne if (savedInstanceState == null) { intent = getIntent(); } else { + createdByViewIntent = savedInstanceState.getBoolean("created_by_view_intent", false); final String search = savedInstanceState.getString("search"); if (search != null) { mInitialSearchValue.push(search); @@ -311,6 +313,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne if (isViewIntent(intent)) { pendingViewIntent.push(intent); + createdByViewIntent = true; setIntent(createLauncherIntent(this)); } else if (startSearching && mInitialSearchValue.peek() == null) { mInitialSearchValue.push(""); @@ -321,6 +324,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne public void onSaveInstanceState(Bundle savedInstanceState) { Intent pendingIntent = pendingViewIntent.peek(); savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent()); + savedInstanceState.putBoolean("created_by_view_intent", createdByViewIntent); if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) { savedInstanceState.putString("search", mSearchEditText != null ? mSearchEditText.getText().toString() : null); } @@ -723,7 +727,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne if (actionBar == null) { return; } - boolean openConversations = !xmppConnectionService.isConversationsListEmpty(null); + boolean openConversations = !createdByViewIntent && !xmppConnectionService.isConversationsListEmpty(null); actionBar.setDisplayHomeAsUpEnabled(openConversations); actionBar.setDisplayHomeAsUpEnabled(openConversations); @@ -937,7 +941,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } private void navigateBack() { - if (xmppConnectionService != null && !xmppConnectionService.isConversationsListEmpty(null)) { + if (!createdByViewIntent && xmppConnectionService != null && !xmppConnectionService.isConversationsListEmpty(null)) { Intent intent = new Intent(this, ConversationsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent); diff --git a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java index c640e42da..559e20648 100644 --- a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java +++ b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java @@ -112,6 +112,7 @@ public class UriHandlerActivity extends AppCompatActivity { intent.putExtra("body", body); } else { intent = new Intent(this, StartConversationActivity.class); + intent.setAction(Intent.ACTION_VIEW); intent.setData(uri); intent.putExtra("account", accounts.get(0).toEscapedString()); } |