diff --git a/res/layout/activity_select_contacts.xml b/res/layout/activity_select_contacts.xml
index 5c2964d405..b412e82ecf 100644
--- a/res/layout/activity_select_contacts.xml
+++ b/res/layout/activity_select_contacts.xml
@@ -33,13 +33,13 @@
android:textColor="@color/text"
android:text="@string/activity_create_closed_group_empty_state_message" />
-
+
+
+
+
+
+
+
diff --git a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt
index 6cacaa7777..0e9b7d13c4 100644
--- a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt
+++ b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt
@@ -151,9 +151,9 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
when (requestCode) {
REQ_CODE_ADD_USERS -> {
if (resultCode != RESULT_OK) return
- if (data == null || data.extras == null || !data.hasExtra(EXTRA_SELECTED_CONTACTS)) return
+ if (data == null || data.extras == null || !data.hasExtra(EXTRA_RESULT_SELECTED_CONTACTS)) return
- val selectedContacts = data.extras!!.getStringArray(EXTRA_SELECTED_CONTACTS)!!.toSet()
+ val selectedContacts = data.extras!!.getStringArray(EXTRA_RESULT_SELECTED_CONTACTS)!!.toSet()
val changedMembers = members + selectedContacts
updateMembers(changedMembers)
}
diff --git a/src/org/thoughtcrime/securesms/loki/activities/SelectContactsActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/SelectContactsActivity.kt
index bc5c77b11d..e71554fb20 100644
--- a/src/org/thoughtcrime/securesms/loki/activities/SelectContactsActivity.kt
+++ b/src/org/thoughtcrime/securesms/loki/activities/SelectContactsActivity.kt
@@ -15,33 +15,27 @@ import network.loki.messenger.R
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.mms.GlideApp
-const val EXTRA_SELECTED_CONTACTS = "SELECTED_CONTACTS_RESULT"
+const val EXTRA_RESULT_SELECTED_CONTACTS = "RESULT_SELECTED_CONTACTS"
+//const val RESULT_CREATE_PRIVATE_CHAT = 100;
class SelectContactsActivity : PassphraseRequiredActionBarActivity(), LoaderManager.LoaderCallbacks> {
private var members = listOf()
set(value) { field = value; selectContactsAdapter.members = value }
- private val selectContactsAdapter by lazy {
- val glide = GlideApp.with(this)
- val result = SelectContactsAdapter(this, glide)
- result
- }
-
- private val selectedMembers: Set
- get() { return selectContactsAdapter.selectedMembers }
-
- companion object {
- public val createNewPrivateChatResultCode = 100
- }
+ private lateinit var selectContactsAdapter: SelectContactsAdapter
// region Lifecycle
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
super.onCreate(savedInstanceState, isReady)
setContentView(R.layout.activity_select_contacts)
supportActionBar!!.title = resources.getString(R.string.activity_select_contacts_title)
+
+ this.selectContactsAdapter = SelectContactsAdapter(this, GlideApp.with(this))
recyclerView.adapter = selectContactsAdapter
recyclerView.layoutManager = LinearLayoutManager(this)
- btnCreateNewPrivateChat.setOnClickListener { createNewPrivateChat() }
+
+// btnCreateNewPrivateChat.setOnClickListener { closeAndCreatePrivateChat() }
+
LoaderManager.getInstance(this).initLoader(0, null, this)
}
@@ -74,25 +68,24 @@ class SelectContactsActivity : PassphraseRequiredActionBarActivity(), LoaderMana
// region Interaction
override fun onOptionsItemSelected(item: MenuItem): Boolean {
- val id = item.itemId
- when(id) {
- R.id.doneButton -> returnContacts()
- else -> { /* Do nothing */ }
+ when(item.itemId) {
+ R.id.doneButton -> closeAndReturnSelected()
}
return super.onOptionsItemSelected(item)
}
- private fun createNewPrivateChat() {
- setResult(createNewPrivateChatResultCode)
- finish()
- }
+// private fun closeAndCreatePrivateChat() {
+// setResult(RESULT_CREATE_PRIVATE_CHAT)
+// finish()
+// }
- private fun returnContacts() {
- val selectedMembers = this.selectedMembers
+ private fun closeAndReturnSelected() {
+ val selectedMembers = this.selectContactsAdapter.selectedMembers
val selectedContacts = selectedMembers.toTypedArray()
- val data = Intent()
- data.putExtra(EXTRA_SELECTED_CONTACTS, selectedContacts)
- setResult(Activity.RESULT_OK, data)
+ val intent = Intent()
+ intent.putExtra(EXTRA_RESULT_SELECTED_CONTACTS, selectedContacts)
+ setResult(Activity.RESULT_OK, intent)
finish()
}
+ // endregion
}
\ No newline at end of file