1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-09 08:18:44 +01:00

make dm conversation directly when create from user profile

This commit is contained in:
Mariotaku Lee 2017-04-24 08:12:37 +08:00
parent 04254f433d
commit e7f0008d6c
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
4 changed files with 9 additions and 3 deletions

View File

@ -29,6 +29,7 @@ Micro-blogging service:
- [ ] Twitter - [ ] Twitter
- [ ] Fanfou - [ ] Fanfou
- [ ] GNU Social / StatusNet - [ ] GNU Social / StatusNet
- [ ] Mastodon
App settings: App settings:

View File

@ -126,6 +126,7 @@ public interface IntentConstants {
String EXTRA_IS_PUBLIC = "is_public"; String EXTRA_IS_PUBLIC = "is_public";
String EXTRA_USER = "user"; String EXTRA_USER = "user";
String EXTRA_USERS = "users"; String EXTRA_USERS = "users";
String EXTRA_OPEN_CONVERSATION = "open_conversation";
String EXTRA_ITEMS = "items"; String EXTRA_ITEMS = "items";
String EXTRA_USER_LIST = "user_list"; String EXTRA_USER_LIST = "user_list";
String EXTRA_USER_LISTS = "user_lists"; String EXTRA_USER_LISTS = "user_lists";

View File

@ -924,6 +924,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
intent.putExtra(EXTRA_ACCOUNT, AccountUtils.getAccountDetails(am, user.account_key, intent.putExtra(EXTRA_ACCOUNT, AccountUtils.getAccountDetails(am, user.account_key,
true)) true))
intent.putExtra(EXTRA_USERS, arrayOf(user)) intent.putExtra(EXTRA_USERS, arrayOf(user))
intent.putExtra(EXTRA_OPEN_CONVERSATION, true)
startActivity(intent) startActivity(intent)
} }
R.id.set_color -> { R.id.set_color -> {

View File

@ -189,9 +189,12 @@ class MessageNewConversationFragment : BaseFragment(), LoaderCallbacks<List<Parc
if (savedInstanceState == null) { if (savedInstanceState == null) {
val users = arguments.getNullableTypedArray<ParcelableUser>(EXTRA_USERS) val users = arguments.getNullableTypedArray<ParcelableUser>(EXTRA_USERS)
if (users != null) { if (users != null && users.isNotEmpty()) {
selectedRecipients = users.toList() selectedRecipients = users.toList()
editParticipants.setSelection(editParticipants.length()) editParticipants.setSelection(editParticipants.length())
if (arguments.getBoolean(EXTRA_OPEN_CONVERSATION)) {
createOrOpenConversation()
}
} }
} }
} }
@ -227,14 +230,14 @@ class MessageNewConversationFragment : BaseFragment(), LoaderCallbacks<List<Parc
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.create_conversation -> { R.id.create_conversation -> {
createConversation() createOrOpenConversation()
return true return true
} }
} }
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
} }
private fun createConversation() { private fun createOrOpenConversation() {
val account = this.account ?: return val account = this.account ?: return
val selected = this.selectedRecipients val selected = this.selectedRecipients
if (selected.isEmpty()) return if (selected.isEmpty()) return