do not show up navigation in start conversation screen if called with view intent
This commit is contained in:
parent
e80fbcfd61
commit
60fc985298
|
@ -110,7 +110,7 @@
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"/>
|
android:windowSoftInputMode="stateAlwaysHidden"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.UriHandlerActivity"
|
android:name=".ui.UriHandlerActivity"
|
||||||
android:label="@string/title_activity_start_conversation">
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,7 @@ import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.Spanned;
|
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.text.style.TypefaceSpan;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
|
@ -101,6 +98,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
private EditText mSearchEditText;
|
private EditText mSearchEditText;
|
||||||
private AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false);
|
private AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false);
|
||||||
private boolean mHideOfflineContacts = false;
|
private boolean mHideOfflineContacts = false;
|
||||||
|
private boolean createdByViewIntent = false;
|
||||||
private MenuItem.OnActionExpandListener mOnActionExpandListener = new MenuItem.OnActionExpandListener() {
|
private MenuItem.OnActionExpandListener mOnActionExpandListener = new MenuItem.OnActionExpandListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -305,6 +303,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
intent = getIntent();
|
intent = getIntent();
|
||||||
} else {
|
} else {
|
||||||
|
createdByViewIntent = savedInstanceState.getBoolean("created_by_view_intent", false);
|
||||||
final String search = savedInstanceState.getString("search");
|
final String search = savedInstanceState.getString("search");
|
||||||
if (search != null) {
|
if (search != null) {
|
||||||
mInitialSearchValue.push(search);
|
mInitialSearchValue.push(search);
|
||||||
|
@ -314,6 +313,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
|
|
||||||
if (isViewIntent(intent)) {
|
if (isViewIntent(intent)) {
|
||||||
pendingViewIntent.push(intent);
|
pendingViewIntent.push(intent);
|
||||||
|
createdByViewIntent = true;
|
||||||
setIntent(createLauncherIntent(this));
|
setIntent(createLauncherIntent(this));
|
||||||
} else if (startSearching && mInitialSearchValue.peek() == null) {
|
} else if (startSearching && mInitialSearchValue.peek() == null) {
|
||||||
mInitialSearchValue.push("");
|
mInitialSearchValue.push("");
|
||||||
|
@ -324,6 +324,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
public void onSaveInstanceState(Bundle savedInstanceState) {
|
public void onSaveInstanceState(Bundle savedInstanceState) {
|
||||||
Intent pendingIntent = pendingViewIntent.peek();
|
Intent pendingIntent = pendingViewIntent.peek();
|
||||||
savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent());
|
savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent());
|
||||||
|
savedInstanceState.putBoolean("created_by_view_intent",createdByViewIntent);
|
||||||
if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) {
|
if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) {
|
||||||
savedInstanceState.putString("search", mSearchEditText != null ? mSearchEditText.getText().toString() : null);
|
savedInstanceState.putString("search", mSearchEditText != null ? mSearchEditText.getText().toString() : null);
|
||||||
}
|
}
|
||||||
|
@ -712,7 +713,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
if (actionBar == null) {
|
if (actionBar == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean openConversations = !xmppConnectionService.isConversationsListEmpty(null);
|
boolean openConversations = !createdByViewIntent && !xmppConnectionService.isConversationsListEmpty(null);
|
||||||
actionBar.setDisplayHomeAsUpEnabled(openConversations);
|
actionBar.setDisplayHomeAsUpEnabled(openConversations);
|
||||||
actionBar.setDisplayHomeAsUpEnabled(openConversations);
|
actionBar.setDisplayHomeAsUpEnabled(openConversations);
|
||||||
|
|
||||||
|
@ -926,7 +927,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
}
|
}
|
||||||
|
|
||||||
private void navigateBack() {
|
private void navigateBack() {
|
||||||
if (xmppConnectionService != null && !xmppConnectionService.isConversationsListEmpty(null)) {
|
if (!createdByViewIntent && xmppConnectionService != null && !xmppConnectionService.isConversationsListEmpty(null)) {
|
||||||
Intent intent = new Intent(this, ConversationsActivity.class);
|
Intent intent = new Intent(this, ConversationsActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -117,6 +117,7 @@ public class UriHandlerActivity extends AppCompatActivity {
|
||||||
intent.putExtra("body", body);
|
intent.putExtra("body", body);
|
||||||
} else {
|
} else {
|
||||||
intent = new Intent(this, StartConversationActivity.class);
|
intent = new Intent(this, StartConversationActivity.class);
|
||||||
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
intent.setData(uri);
|
intent.setData(uri);
|
||||||
intent.putExtra("account", accounts.get(0).toEscapedString());
|
intent.putExtra("account", accounts.get(0).toEscapedString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue