mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
* refactor: Migrate home screen to data binding * Add view binding * Migrate ConversationView to view binding * Migrate ConversationActivityV2 to view binding * View model refactor * Move more functionality to the view model * Add ui state events flow * Update conversation item bindings * Update profile picture view bindings * Replace Kotlin synthetics with view bindings * Fix qr code fragment binding and optimize imports * View binding refactors * Make TextSecurePreferences an interface and add an implementation to improve testability * Add conversation repository * Migrate remaining TextSecurePreferences functions into the interface * Add unit conversation unit tests * Add unit test coverage for remaining view model functions
25 lines
1 KiB
Kotlin
25 lines
1 KiB
Kotlin
package org.thoughtcrime.securesms.conversation.v2.dialogs
|
|
|
|
import android.view.LayoutInflater
|
|
import androidx.appcompat.app.AlertDialog
|
|
import network.loki.messenger.databinding.DialogLinkPreviewBinding
|
|
import org.session.libsession.utilities.TextSecurePreferences
|
|
import org.thoughtcrime.securesms.conversation.v2.utilities.BaseDialog
|
|
|
|
/** Shown the first time the user inputs a URL that could generate a link preview, to
|
|
* let them know that Session offers the ability to send and receive link previews. */
|
|
class LinkPreviewDialog(private val onEnabled: () -> Unit) : BaseDialog() {
|
|
|
|
override fun setContentView(builder: AlertDialog.Builder) {
|
|
val binding = DialogLinkPreviewBinding.inflate(LayoutInflater.from(requireContext()))
|
|
binding.cancelButton.setOnClickListener { dismiss() }
|
|
binding.enableLinkPreviewsButton.setOnClickListener { enable() }
|
|
builder.setView(binding.root)
|
|
}
|
|
|
|
private fun enable() {
|
|
TextSecurePreferences.setLinkPreviewsEnabled(requireContext(), true)
|
|
dismiss()
|
|
onEnabled()
|
|
}
|
|
} |