2020-07-16 03:58:11 +02:00
|
|
|
package org.thoughtcrime.securesms.loki.dialogs
|
|
|
|
|
|
|
|
import android.os.Bundle
|
2020-08-19 02:06:26 +02:00
|
|
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
2020-07-16 03:58:11 +02:00
|
|
|
import android.view.LayoutInflater
|
|
|
|
import android.view.View
|
|
|
|
import android.view.ViewGroup
|
|
|
|
import kotlinx.android.synthetic.main.fragment_conversation_bottom_sheet.*
|
|
|
|
import kotlinx.android.synthetic.main.fragment_device_list_bottom_sheet.*
|
|
|
|
import network.loki.messenger.R
|
|
|
|
import org.thoughtcrime.securesms.recipients.Recipient
|
|
|
|
|
|
|
|
public class ConversationOptionsBottomSheet : BottomSheetDialogFragment() {
|
|
|
|
lateinit var recipient: Recipient
|
2020-08-21 07:06:39 +02:00
|
|
|
var onBlockTapped: (() -> Unit)? = null
|
|
|
|
var onUnblockTapped: (() -> Unit)? = null
|
2020-07-16 03:58:11 +02:00
|
|
|
var onDeleteTapped: (() -> Unit)? = null
|
|
|
|
|
|
|
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
|
|
|
return inflater.inflate(R.layout.fragment_conversation_bottom_sheet, container, false)
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
super.onViewCreated(view, savedInstanceState)
|
|
|
|
if (!recipient.isGroupRecipient && !recipient.isLocalNumber) {
|
2020-08-21 07:06:39 +02:00
|
|
|
unblockTextView.visibility = if (recipient.isBlocked) View.VISIBLE else View.GONE
|
|
|
|
blockTextView.visibility = if (recipient.isBlocked) View.GONE else View.VISIBLE
|
|
|
|
|
|
|
|
blockTextView.setOnClickListener { onBlockTapped?.invoke() }
|
|
|
|
unblockTextView.setOnClickListener { onUnblockTapped?.invoke() }
|
2020-07-16 03:58:11 +02:00
|
|
|
}
|
|
|
|
deleteTextView.setOnClickListener { onDeleteTapped?.invoke() }
|
|
|
|
}
|
|
|
|
}
|