move template chooser to MaterialAlterDialog

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-09-12 15:40:22 +02:00 committed by Álvaro Brey
parent 5d84bfc2e4
commit ee170a4e4c
No known key found for this signature in database
GPG key ID: 2585783189A62105

View file

@ -35,6 +35,7 @@ import android.widget.Button
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.nextcloud.android.lib.resources.directediting.DirectEditingCreateFileRemoteOperation import com.nextcloud.android.lib.resources.directediting.DirectEditingCreateFileRemoteOperation
import com.nextcloud.android.lib.resources.directediting.DirectEditingObtainListOfTemplatesRemoteOperation import com.nextcloud.android.lib.resources.directediting.DirectEditingObtainListOfTemplatesRemoteOperation
import com.nextcloud.client.account.CurrentAccountProvider import com.nextcloud.client.account.CurrentAccountProvider
@ -171,11 +172,14 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem
binding.list.adapter = adapter binding.list.adapter = adapter
// Build the dialog // Build the dialog
val builder = AlertDialog.Builder(activity) val builder = MaterialAlertDialogBuilder(activity)
builder.setView(view) builder.setView(view)
.setPositiveButton(R.string.create, null) .setPositiveButton(R.string.create, null)
.setNeutralButton(R.string.common_cancel, null) .setNeutralButton(R.string.common_cancel, null)
.setTitle(title) .setTitle(title)
viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.list.context, builder)
val dialog: Dialog = builder.create() val dialog: Dialog = builder.create()
val window = dialog.window val window = dialog.window
window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE) window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)