1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-01-23 13:30:17 +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
- [ ] Fanfou
- [ ] GNU Social / StatusNet
- [ ] Mastodon
App settings:

View File

@ -126,6 +126,7 @@ public interface IntentConstants {
String EXTRA_IS_PUBLIC = "is_public";
String EXTRA_USER = "user";
String EXTRA_USERS = "users";
String EXTRA_OPEN_CONVERSATION = "open_conversation";
String EXTRA_ITEMS = "items";
String EXTRA_USER_LIST = "user_list";
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,
true))
intent.putExtra(EXTRA_USERS, arrayOf(user))
intent.putExtra(EXTRA_OPEN_CONVERSATION, true)
startActivity(intent)
}
R.id.set_color -> {

View File

@ -189,9 +189,12 @@ class MessageNewConversationFragment : BaseFragment(), LoaderCallbacks<List<Parc
if (savedInstanceState == null) {
val users = arguments.getNullableTypedArray<ParcelableUser>(EXTRA_USERS)
if (users != null) {
if (users != null && users.isNotEmpty()) {
selectedRecipients = users.toList()
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 {
when (item.itemId) {
R.id.create_conversation -> {
createConversation()
createOrOpenConversation()
return true
}
}
return super.onOptionsItemSelected(item)
}
private fun createConversation() {
private fun createOrOpenConversation() {
val account = this.account ?: return
val selected = this.selectedRecipients
if (selected.isEmpty()) return