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"/> | ||||
|         <activity | ||||
|             android:name=".ui.UriHandlerActivity" | ||||
|             android:label="@string/title_activity_start_conversation"> | ||||
|             android:label="@string/app_name"> | ||||
|             <intent-filter> | ||||
|                 <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.widget.Toolbar; | ||||
| import android.text.Editable; | ||||
| import android.text.SpannableString; | ||||
| import android.text.Spanned; | ||||
| import android.text.TextWatcher; | ||||
| import android.text.style.TypefaceSpan; | ||||
| import android.util.Log; | ||||
| import android.util.Pair; | ||||
| import android.view.ContextMenu; | ||||
| @ -101,6 +98,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 | ||||
| @ -305,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); | ||||
| @ -314,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(""); | ||||
| @ -324,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); | ||||
| 		} | ||||
| @ -712,7 +713,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); | ||||
| 
 | ||||
| @ -926,7 +927,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); | ||||
|  | ||||
| @ -117,6 +117,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()); | ||||
|                 } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Gultsch
						Daniel Gultsch