mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Merge pull request #711 from hjubb/bottom_sheet_conversation
Allow Messaging from User details sheet
This commit is contained in:
commit
4bc9bdea73
@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -14,9 +15,11 @@ import android.widget.Toast
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kotlinx.android.synthetic.main.fragment_user_details_bottom_sheet.*
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.messaging.MessagingModuleConfiguration
|
||||
import org.session.libsession.messaging.contacts.Contact
|
||||
import org.session.libsession.utilities.Address
|
||||
import org.session.libsession.utilities.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||
import org.thoughtcrime.securesms.mms.GlideApp
|
||||
import org.thoughtcrime.securesms.util.UiModeUtilities
|
||||
@ -63,11 +66,23 @@ class UserDetailsBottomSheet : BottomSheetDialogFragment() {
|
||||
}
|
||||
nameTextView.text = recipient.name ?: publicKey // Uses the Contact API internally
|
||||
publicKeyTextView.text = publicKey
|
||||
copyButton.setOnClickListener {
|
||||
publicKeyTextView.setOnLongClickListener {
|
||||
val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val clip = ClipData.newPlainText("Session ID", publicKey)
|
||||
clipboard.setPrimaryClip(clip)
|
||||
Toast.makeText(requireContext(), R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
|
||||
true
|
||||
}
|
||||
messageButton.setOnClickListener {
|
||||
val threadId = MessagingModuleConfiguration.shared.storage.getThreadId(recipient)
|
||||
val intent = Intent(
|
||||
context,
|
||||
ConversationActivityV2::class.java
|
||||
)
|
||||
intent.putExtra(ConversationActivityV2.ADDRESS, recipient.address)
|
||||
intent.putExtra(ConversationActivityV2.THREAD_ID, threadId ?: -1)
|
||||
startActivity(intent)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,12 +111,12 @@
|
||||
|
||||
<Button
|
||||
style="@style/Widget.Session.Button.Common.ProminentOutline"
|
||||
android:id="@+id/copyButton"
|
||||
android:id="@+id/messageButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/medium_button_height"
|
||||
android:layout_marginTop="@dimen/medium_spacing"
|
||||
android:paddingLeft="@dimen/large_spacing"
|
||||
android:paddingRight="@dimen/large_spacing"
|
||||
android:text="@string/copy" />
|
||||
android:text="@string/ConversationActivity_message" />
|
||||
|
||||
</LinearLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user