|
@@ -24,51 +24,26 @@ import android.app.Activity
|
|
|
import android.os.Bundle
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
-import android.widget.LinearLayout
|
|
|
-import androidx.appcompat.widget.AppCompatTextView
|
|
|
-import butterknife.BindView
|
|
|
-import butterknife.ButterKnife
|
|
|
-import butterknife.Unbinder
|
|
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
|
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
|
|
import com.nextcloud.talk.R
|
|
|
import com.nextcloud.talk.components.filebrowser.controllers.BrowserController
|
|
|
import com.nextcloud.talk.controllers.ChatController
|
|
|
+import com.nextcloud.talk.databinding.DialogAttachmentBinding
|
|
|
import com.nextcloud.talk.models.database.CapabilitiesUtil
|
|
|
|
|
|
class AttachmentDialog(val activity: Activity, var chatController: ChatController) : BottomSheetDialog(activity) {
|
|
|
|
|
|
- @BindView(R.id.menu_share_location)
|
|
|
- @JvmField
|
|
|
- var shareLocationItem: LinearLayout? = null
|
|
|
-
|
|
|
- @BindView(R.id.txt_share_location)
|
|
|
- @JvmField
|
|
|
- var shareLocation: AppCompatTextView? = null
|
|
|
-
|
|
|
- @BindView(R.id.txt_attach_file_from_local)
|
|
|
- @JvmField
|
|
|
- var attachFromLocal: AppCompatTextView? = null
|
|
|
-
|
|
|
- @BindView(R.id.txt_attach_file_from_cloud)
|
|
|
- @JvmField
|
|
|
- var attachFromCloud: AppCompatTextView? = null
|
|
|
-
|
|
|
- @BindView(R.id.menu_attach_picture_from_cam)
|
|
|
- @JvmField
|
|
|
- var pictureFromCamItem: LinearLayout? = null
|
|
|
-
|
|
|
- private var unbinder: Unbinder? = null
|
|
|
+ private lateinit var dialogAttachmentBinding: DialogAttachmentBinding
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
- val view = layoutInflater.inflate(R.layout.dialog_attachment, null)
|
|
|
- setContentView(view)
|
|
|
+ dialogAttachmentBinding = DialogAttachmentBinding.inflate(layoutInflater)
|
|
|
+ setContentView(dialogAttachmentBinding.root)
|
|
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
|
- unbinder = ButterKnife.bind(this, view)
|
|
|
|
|
|
var serverName = CapabilitiesUtil.getServerName(chatController.conversationUser)
|
|
|
- attachFromCloud?.text = chatController.resources?.let {
|
|
|
+ dialogAttachmentBinding.txtAttachFileFromCloud.text = chatController.resources?.let {
|
|
|
if (serverName.isNullOrEmpty()) {
|
|
|
serverName = it.getString(R.string.nc_server_product_name)
|
|
|
}
|
|
@@ -80,25 +55,25 @@ class AttachmentDialog(val activity: Activity, var chatController: ChatControlle
|
|
|
"geo-location-sharing"
|
|
|
)
|
|
|
) {
|
|
|
- shareLocationItem?.visibility = View.GONE
|
|
|
+ dialogAttachmentBinding.menuShareLocation.visibility = View.GONE
|
|
|
}
|
|
|
|
|
|
- shareLocation?.setOnClickListener {
|
|
|
+ dialogAttachmentBinding.menuShareLocation.setOnClickListener {
|
|
|
chatController.showShareLocationScreen()
|
|
|
dismiss()
|
|
|
}
|
|
|
|
|
|
- attachFromLocal?.setOnClickListener {
|
|
|
+ dialogAttachmentBinding.menuAttachFileFromLocal.setOnClickListener {
|
|
|
chatController.sendSelectLocalFileIntent()
|
|
|
dismiss()
|
|
|
}
|
|
|
|
|
|
- pictureFromCamItem?.setOnClickListener {
|
|
|
+ dialogAttachmentBinding.menuAttachPictureFromCam.setOnClickListener {
|
|
|
chatController.sendPictureFromCamIntent()
|
|
|
dismiss()
|
|
|
}
|
|
|
|
|
|
- attachFromCloud?.setOnClickListener {
|
|
|
+ dialogAttachmentBinding.menuAttachFileFromCloud.setOnClickListener {
|
|
|
chatController.showBrowserScreen(BrowserController.BrowserType.DAV_BROWSER)
|
|
|
dismiss()
|
|
|
}
|